|
|
# How-to Git in GPIAG-Software
|
|
|
|
|
|
## General
|
|
|
A nice introduction in version control with git is given by [www.git-tower.com/learn/](https://www.git-tower.com/learn/).
|
|
|
|
|
|
- Most important Git commands: [Git Cheat Sheet](https://www.git-tower.com/learn/cheat-sheets/git)
|
|
|
- Most important command line commands: [Command Line Cheat Sheet](https://www.git-tower.com/learn/cheat-sheets/cli)
|
|
|
|
|
|
|
|
|
## Branching model
|
|
|
We use a Git branching model based on the idea of [Vincent Driessen](http://nvie.com) which is well-known as [Git-flow](http://nvie.com/posts/a-successful-git-branching-model/).
|
|
|
The general scheme of this branching model can be identified in the following diagram image from [Vincent Driessen](http://nvie.com) [(Creative Commons BY-SA)](https://creativecommons.org/licenses/by-sa/3.0/):
|
|
|
|
|
|
![Diagram Image Git-flow](/uploads/6e94a0b2c310b34a9f6b94fefc1aabf3/Git-branching-model.pdf)
|
|
|
|
|
|
In principal git-flow is a naming convention for our branches:
|
|
|
|
|
|
| Type | Naming |
|
|
|
|-----------------------|------------|
|
|
|
| Production Branch | master |
|
|
|
| Development Branch | develop |
|
|
|
| Feature Branch Prefix | feature/ |
|
|
|
| Hotfix Branch Prefix | hotfix/ |
|
|
|
| Release Branch Prefix | release/ |
|
|
|
|
|
|
|
|
|
### Create a new feature
|
|
|
|
|
|
Lets say you want to add a new feature called YOURFEATURE to the code.
|
|
|
|
|
|
First, you have to create a new branch called feature/YOURFEATURE, you can do this in your local repository by
|
|
|
```
|
|
|
git checkout -b feature/YOURFEATURE
|
|
|
```
|
|
|
Now you are ready to develop your feature and add commits as you like. Once the feature is ready, it has to be merged into develop. This can be done by e.g.:
|
|
|
```
|
|
|
git checkout develop
|
|
|
git pull origin develop
|
|
|
git merge --no-ff feature/YOURFEATURE
|
|
|
# May you have to clear some merge conflicts at this point
|
|
|
git push origin develop
|
|
|
# If you do not have rights to push into develop directly open a merge request.
|
|
|
```
|
|
|
Make sure you set the **--no-ff** tag when you merge your feature into develop. The effect of --no-ff is described in detail [here](http://nvie.com/posts/a-successful-git-branching-model/). |
|
|
\ No newline at end of file |