Git Workflow - acc-g14/airfoil-cloud-simulator GitHub Wiki

Git Workflow

Create new branch

If you want to create a new branch, either do it on github or do it in the console by using the following commands (It's important that you always create a branch from the current master):

git checkout master
git pull origin master
git checkout -b branchname

Update branch

If you want to update your branch with the current status of another branch (most likely the master branch), execute the following steps:

git checkout master
git pull master # fetch eventual changes
git checkout branchname
git pull branchname # fetch eventual changes
git rebase master

After your rebase was successful and you fixed eventual conflicts, try to push the changes to the remote repository by using

git push

If an error message pops up about not beeing able to fast-forward changes to the remote repository, you have to use (and only in this case!!!)

git push -f

Merge branch

If you want to merge your branch into the master branch, issue a pull request on the GitHub page and ask the others of the team to look over the code. If all remaining issues are figured out, you can go on with merging the branch into the master branch.

First do a rebase of your code on the master branch as described above. Then go on with merging: If it's possible by doing it with the automated GitHub function, go that way. Otherwise you have to perform the merge in a manual way:

git checkout branchname
git pull
git checkout master
git pull
git merge branchname