Keeping your github forks in sync
I have a ton of forked projects in my github account, as do most of us. This is what I use to keep my master synced with the upstream master. It works particularly well with Openstack, because there are a ton of projects that are updated constantly.
First, set up your upstream master (after forking and cloning your own):
git remote add upstream git://github.com/user/repo.git
Then in my .bash_profile I added the following functions:
gitreporefresh() {
for i in `ls $HOME/dev/repos`; do
_gitreporefreshone $i &
done
}
_gitreporefreshone() {
cd $HOME/dev/repos/$i
git pull upstream master
git add .
git commit -a -m "resync upstream on `date`"
git push
cd -
}
I don't work out of my fork's master, I just branch everything and merge back in frequently. If you want to merge multiple sources (say, your master fork and the upstream) you could use something this. Also, don't forget to rebase!
git fetch origin
git fetch upstream
git merge upstream/master
Written by chalupaul
Related protips
1 Response
Is there a way to do that on the web-interface?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Openstack
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#