Git Branch Management with Aldryn

For some reason on the Aldryn git, it’s not so easy to share branches between different collaborators. One doesn’t see the other’s branches.

Here is how to load the branch of a collaborator:

# See all branches
git fetch origin
git branch -r
# 'activate' a branch
git branch --track  origin/

Here is how to sync branches with rebase:

# in a feature branch:
# Do as if work in the feature branch had started on top of the changes that have been made in the meantime to the develop branch:
git checkout develop
git pull
git checkout feature-branch
git rebase develop
# If there are conflicts you can either resolve them manually or in order to fix quickly (for example the updates to config files by Aldryn) you can use:
git checkout --ours foo/bar.js
# to take the feature-branch version use --theirs, for the develop branch version use --ours

Having your Aldryn project in Github allows for easy diffs between branches and a structured workflow with multiple collaborators:

# add a github repository as second remote
git remote add github
# now collaborators can push with
git push github