Using Git is central to working with EmbeddedMontiArc projects since they are all hosted on the GitLab instance of RWTH. For a graphical user interface you can use GitHub Desktop and link the different repositories in its interface. This allows to stage, commit, push, pull and merge from the GUI. For installing GitHub Desktop under linux, check out this repository.
If you use Visual Studio Code, then there is already a GUI for git integrated.
The following is a recap of the git process and a list of useful git commands.
Gitignore
The .gitignore
file contains folder and file names or patterns (using the wildcard *) of files that will not be included in any way in the repository: the files will not be listed in the un-staged changes. To explicitly include a file use the negative pattern !name_to_include
.
Git branches and repositories
Git works by having remote and local repositories. The remote repositories are hosted on the GitLab and are common to everybody. The local repositories are an instance of a remote repository somewhere in a folder on your computer (e.g. created through git clone <link.git>
).
Every repository can have multiple branches: different versions of the repository content. To create a branch locally use git checkout <branchName>
. If the branch exists in the remote repository, it will update the local files to the state of the remote repository. The changes made to the local repository will be attributed to the current branch.
Changes to files in the local repository are at first in an un-staged state. By staging them (git add ...
), they will be part of the next commit. When a commit is created with git commit -m "Commit Description"
, only the staged changes will be included in it.
Commits are only in the local repository at first. The state between the local and the remote repository is handled with the git pull
and git push
commands. Pulling is downloading the latest changes from the remote repository. Pushing is sending the local commits to the remote repository.
Merge requests
The Master branch of the projects represent their current latest stand. To put the changes from a branch into the master, a Merge Request has to be created on the branch webpage. For a branch to be merged into the master, following criteria must be met:
- The branch contains the latest commit of the master.
- All merge conflicts with the master branch are resolved.
- For Maven projects, the project version number must be incremented from the current master state so that a new artifact can be pushed to the nexus.