I've posted this in the Past, but I'll do this
again from this
thread. Been using this for a year now, works for collaboration as well as individuals:
Book A guide to GIT.
Here it is:
I have this quick start guide that I made to use a version control system we have control over ourselves.
Here it is:
Hello PLCs.net!
I have Git up and running within my team. Git is a way to chronologically save stuff over time, so you don’t lose work which hasn’t been saved as a new copy of the old program. A repository is supposed to be an easy to maneuver location where code (Ladder logic woot woot!) and artifacts (E.G: HMI files) are stored.
The following is a small tutorial on how to use git, as well as an advanced in depth way of working with Rockwell tools and Git at the same time. You can make a personal repo just for yourself, or a combined repo for yourself as well as your teammates in a shared location. Both add value to my workflow personally.
We have the following code storage structure in our team:
-> Remote directory on a shared drive
-> Local directory per team-member
Tools used: -
- Windows 7 Pro(Home should do too, I think)
- Git Extensions 3.00.00.4433 : GUI which simplifies GIT for users.
- Git 2.19.2.windows.1 : Latest git release I could find.
- Studio 5000 Logix Designer V16-28 : All the different PLC firmwares we use in our plant. Haven't tested on all of them, but seems to be working fine with any I use.
- Logix Designer Compare v7.00.00 : Latest compare tool I could get my hands on.
OK, so here is what I did on the config side:
1) Make sure you have GitExtensions and Git installed on your machine.
2) If you want the capability of comparing, make sure you have LogixCompare installed on your machine as well.
3) Make an empty directory in a local location(Somewhere on your computer), then right click in windows explorer, and click GitExt Create new repository> Personal Repo> Create.
4) Once you have this empty repository, right click in windows explorer, and then GitExt Open repository.
5) In GitExt, click repository on the top right> Edit .gitignore > Add default ignores.
6) Then paste the following in there:
#Ignore useless packages created by RSLogix.
*.bak*acd
*.acd.recovery
*.sem
*.wrk
This would stop the temporary files from being backed up, and will declutter your system.
7) Hit save.
8) Now go to Tools> Settings>Git>Config. Enter your username and email. Hit save.
9) At this point, start moving your PLC code into this repository. which is logically and wisely created, so it's easy to maneuver through the programs you have.
10) Once you have them in the repo, it the Commit button at the top, it’ll pull up a commit dialog.
11) Hit commit, and then there you have it, the first node of your first git branch is now created.
At this point, you can start using git as a simple chronological way. It’s widely used in the code development industry, so you can look up anything from tutorials to error questions directly on google. Stack Overflow is my favorite resource.
12) Now comes the interesting part about how to merge Rockwell with Git. Make sure you have Logix Compare installed.
13) Bring back the Config menu from the earlier step. Now:
• Here, you’ll find an option to fill in your username, email, etc.
• In MergeTool: Type in something like RSLogixMerge, which defines a new mergetool in Git.
• My path to mergetool was: C:/Program Files (x86)/Rockwell Software/Logix Designer Tools/Logix Designer Compare Tool/RSLCompare.exe
• The mergetool command was: "C:/Program Files (x86)/Rockwell Software/Logix Designer Tools/Logix Designer Compare Tool/RSLCompare.exe" -m "$LOCAL" "$REMOTE" -PM FastestCompare
o This follows the syntax of the RSLogix command line switches.
• In Difftool type in something like RSLogixDiff, which defines a new difftool in git.
• My path to difftool was: C:/Program Files (x86)/Rockwell Software/Logix Designer Tools/Logix Designer Compare Tool/RSLCompare.exe
• My difftool command was: 'C:/Program Files (x86)/Rockwell Software/Logix Designer Tools/Logix Designer Compare Tool/RSLCompare.exe' "$LOCAL" "$REMOTE" -PM FastestCompare
• Line endings: Not Set.
Hit apply, and you are set! Now, if you commit an ACD file, make a change, save it, and then commit another file.
You can use any youtube video to learn about how to use git-extensions further after that. But that should follow the standard process at that point.