Skip to content

Working with Git and Branches

Timotheus Pokorra edited this page Jan 30, 2018 · 2 revisions

Each developer or pair of developers forks/branches the project https://github.com/ICCM-EU/BOF into his own github area.

login to the developer server:

ssh <myusername>@dev.bof.iccm.pokorra.de

configure git for you:

git config --global user.name "Firstname Lastname"
git config --global user.email "[email protected]"
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'
git config --global push.default simple

You clone from your own repo, eg.

git clone https://github.com/<mygithubusername>/BOF.git
cd BOF

You should set up a branch for upstream:

git remote add upstream https://github.com/ICCM-EU/BOF.git
git fetch upstream
git checkout --track remotes/upstream/master -b upstream_master
git checkout master

You create your own branch with a name:

git checkout -b <mynewfeature>

You push it for the first time like this:

git push origin <mynewfeature>

Next time you want to push this branch, you only need to say:

git push

Committing works like this:

git add . git commit -a -m "my comment" git push

When you are happy with your branch, create a pull request on the Github webpage of your repository. see https://help.github.com/articles/creating-a-pull-request/

When you want to get the fresh version from upstream:

commit all your changes

git commit -a -m "my comment" git checkout upstream_master

to get the latest changes

git pull

Now you can either merge this into your branch: git checkout mybranch git merge upstream_master git push

Or you can start a new branch based on upstream_master, which is still your current branch: git checkout -b mynextbranch git push origin mynextbranch