Working with GIT branches

We are using branches to structure our development efforts while keeping always a stable version.
See the Overview of branches that we are currently working on. If you create a new branch in the repository, please add it to that page.

Change to a different branch

If you want to change to a different branch, there are different scenarios for what you want to do. We'll take them one by one. Regardlessly, you will have to start by changing directory into the folder where you want to work:

cd Modules/modular

Change to a branch that already exists locally.

First you might want to list what branches are activated locally:

git branch

Next you can checkout (change to) the desired branch:

git checkout nameOfBranch

Change to a branch that exists upstream

You can list all branches, also those who are available upstream, but have not yet been activated locally:

git branch -a

Next you can change to the desired branch and create a working copy of it:

git checkout --track remotes/origin/nameOfTheBranch

Create a new branch from existing one.

First checkout the branch you will be branching from:

git checkout nameOfBranchToStartOffFrom

Now create a new branch:

git checkout -b nameOfNewBranch

Push the new branch to github, and then track the remote branch:

git push origin nameOfTheBranch
git branch --set-upstream-to origin/nameOfTheBranch

Delete a branch:

First move away from the branch by checking out another.

git checkout anotherBranch

Now delete the branch

git branch -d nameOfBranchToGetRidOff

Cleaning up branches that no longer exists upstream.

If a branch has been removed from GitHub, you can get rid of your local copy of it this way:

git remote prune origin

More on branches