Requirement: CODESYS Git is installed. A CODESYS project is open.
-
Prepare an empty directory in the file system for the Git project repository to contain the local Git repository. Example: D:\git_local\rep1
-
In CODESYS Git, open the CODESYS project which should be placed under Git management. Example: myproj.project.
-
Click the Git → Initialize Git Repository command.
The Initialize Git Repository dialog opens.
-
In the dialog, specify the path of the empty directory for the Git project storage (example: D:\git_local\rep1). The Git repository created there is your local "master".
-
If there is no global configuration file .gitconfig in the local user directory (example: C:\Users\m.muster), then a dialog prompt will open for you to create a basic configuration CODESYS Git 9 for all CODESYS Git actions. You get the same dialog for entering some parameters as via the Git Config command ⮫ “Command: Git Config”. The default setting for Default Branch is master. Enter your user data Username and Email address (example m.muster, m.muster@company.com).
-
The objects in the project navigator are provided with blue plus signs
(status: "added"), and the root node (project name) is provided with an orange square
(status: "changed").
-
The path of the Git project storage is displayed in the Git → Project Settings view.
-
As a result, the project management in the Git repository located in the project storage is initialized.
-
-
Save the project (as usual without Git management) in a separate project directory (example: D:\git_projects\myproj.project). Note: The project files are therefore subject to double data management.
-
Open the “Git Status” view. In “Unstaged Changes” in the lower part, select the displayed project objects. Then click the "plus"-button to stage it for a commit. The objects are moved above to “Staged Changes”.
-
Click the commit button
. In the “Commit staged changes” dialog, enter a commit message and click [OK] to confirm. The current status of the project objects is committed to the local repository.
-
Click the Git → Git History command.
-
In the “History” view, the first commit for the "master" is shown with more information.
-
In the project navigator, solid green circle symbols
are displayed in front of the committed objects and in front of the root. This means that the status of the project is in sync with its status in the Git repository.
-
-
Click the Git → Git Branches command and enable the “Local (1)” filter. The default branch for the Git repository is visible as master (refs/heads/master).
-
In the file system, go to the local repository D:\git_local\rep1. Now the directory .git (the actual Git repository) is located here with the subdirectory project and the files .gitattributes, .gitignore, and .apsession. The directory project contains the objects of the CODESYS project.
-
Now you can still link the project (when necessary) with a remote repository.