CODESYS Git makes it possible to use the distributed Git version control system in CODESYS in order to manage versions of CODESYS projects.
The implementation of CODESYS Git is based on the work in Git and on the terminology of Git. After the installation, the menu bar of CODESYS will include the Git menu with the commands to initialize a Git project and work with the linked Git repositories.
See the following for some of the terminology used in the CODESYS Git help and in the CODESYS Git user interface. Corresponding standard Git commands are included.
Basic knowledge of working with Git is a prerequisite. For documentation about this, see (for example): Git Book, Atlassian Git Bucket
NOTICE | |
---|---|
Git repository, Git project storage ("working directory", "working tree") |
For the purely local repository for a CODESYS Git project, we use the shortened term "Git repository" here.
The Git repository is located in the file system, in the "Git project storage", in the subdirectory
The Git project storage also contains the Git management files The path of the Git project storage of a project can be seen in the Git Project Settings view. |
CODESYS project directory |
A project which is managed with CODESYS Git is also always stored in an ordinary CODESYS project directory in addition to being stored in the Git project storage (double data management). |
Remote repository: View: Git Remotes
|
Remote repositories are versions of your project which are hosted on the Internet or somewhere on your network. It is entirely possible that you can work with a "remote" repository which is actually located on the same computer (host) which you are currently working on.
The remote repository is usually named
A CODESYS project which is already managed in Git in a local Git repository can be linked with a remote repository in the Git Remotes view ( Only after that can local branches "track" remote branches and can equivalent branches be created for local branches in the remote repository ("upstream"). And only after that can the Fetch, Pull, Push, and Merge commands be used for the exchange/merge of commits between the local Git repository and the remote repository. |
Local branches, remote branches View: Git Branches
|
There are exactly two kinds of branches: "local" and "remote". A local branch can "track" exactly one remote branch. Local branches: Local branches are displayed in the Git Branches Local (<n>) view.
The local standard branch of a Git repository (usually A local branch is also created by copying an existing local branch, or by checking out a remote branch. In the last case, the recently created local branch automatically tracks the remote branch. Remote branches: Remote branches are displayed in the Git Branches Remote (<n>) view. They are the existing representatives in the Git repository of the respective branch with the same name in the remote repository. Remote branches are used only internally as an "intermediate location" for communication via Push / Pull with the remote repository and are not used directly by the user. |
“Upstream" Command in the Git Branches Local view
|
The Upstream Set action causes a branch, which corresponds to the local branch, to be created in the remote repository (remote branch). |
"Tracking", "Remote tracking branches" Command in the Git Branches view
|
Track branch means creating a link between a local branch and a remote branch.
Default case: The local representative branch When a local branch tracks a remote branch, an exchange of commits with the remote repository is possible by means of Pull and Push. Alternatively, you could also use the Checkout command in the Git Branches Remote (<n>) view to create a local "tracking" branch, which is set as "current" branch at the same time, for an existing remote branch. The current branch is the one where new commits arrive. |
Git index View: Git Status
|
The index is a Git-internal intermediate level between the working directory and the Git repository. It allows for selectively marking only a selection of changed objects for a commit. Not all changes have to be checked in as a commit. Objects which are located in the Git index are visible in the Git Status view, in the Staged Changes section. |
Resynchronization and reloading the project Synchronization |
The CODESYS project in CODESYS is resynchronized with the current state from the Git project storage after each Git operation which performs a change to the Git repository. These operations include the following:
The resynchronization of the CODESYS project has the effect the project is rebuilt completely from the repository. No attempt is made to update the project. You can use the Rebuild Project from Repository to explicitly initiate a resynchronization. Synchronization, on the other hand, is the application of changes from the CODESYS project storage to the Git project repository. This happens whenever a change is made in the CODESYS project. When changes are made to the project, exactly only those changes are applied. When the project is reopened, the complete project is applied to the Git project repository again and overwrites the state there. You can use the Synchronize project with Git project storage command (not in the Git menu by default) to explicitly initiate a synchronization. |