This guide will take you through the first steps in using Git as a version control system for a B&R Automation Studio (AS) project.
- Download and install the most recent version of Automation Studio from the B&R homepage
- Download and install the most recent version of Git from the Git homepage
In this guide, we use Git BASH to use Git from the command line. If you prefer a GUI, the Git homepage has an overview.
If you haven't already entered your name and email in the Git configuration, you must do this now.
Open git bash and enter:
git config --global user.name '<my_name>'
git config --global user.email '<my_email@my_domain.com>'
Create an Automation Studio project as you are used to.
In your project directory, add a new file and name it ".gitignore".
touch .gitignore
This file specifies files that you do not want to put under version control, such as binary files and automatically generated files.
Open .gitignore in a text editor and enter:
/Binaries
/Diagnosis
/Temp
/*.set
/*.isopen
Open git bash in your project directory and enter:
git init
This creates a Git repository inside your project directory.
Open git bash in your project directory and enter:
git add .
This stages all files (except the ones in .gitignore) for your next commit.
Open git bash in your project directory and enter:
git commit -m 'initial commit'
Congratulations! Your project is now under version control with Git.
But this is just the beginning, there is much more to Git! You will probably want to use a remote repository on your server or on a hosted platform like GitHub, so that you have a backup of your data and so that you can work in teams.
In this tutorial, we decided to only show you the very first steps. With the exception of the .gitignore settings, everything in this tutorial is standard Git and not B&R-specific. There are a lot of great ressources out there that cover Git in great depth, here is a small selection: