Sometimes it is useful to have local branches following all branches in a remote repository. For example, if building debian packages from git repositories fetched from git.debian.org using git-buildpackage, one normally needs master, debian and pristine-tar branches.

To update each of those, one has to run

git fetch remotename

and then for each branch run

git checkout branchname
git merge remotename/branchname

Here is a helpful script to do all that automatically. Just ensure that your working directory is clean, and run

git-update-from remotename

and you get all local branches updated (and new ones created if new branches appear on the remote server).

Leave a Reply

Spam Protection by WP-SpamFree Plugin