Created
March 27, 2012 18:00
-
-
Save snijsure/2218449 to your computer and use it in GitHub Desktop.
How to track a parent branch?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. I have setup a git repo called parent.git using | |
git init --bare | |
2. Added some files to this parent.git , commited those files and pushed the changes. | |
3. Now I created a clone of parent.git called trackparent.git as, intent is that trackparent repo will closely track the changes to parent git | |
git clone --bare --shared ssh://gitserver/opt/git/parent.git | |
4. Now say users John and Matt are supposed to work off of trackparent.git and make their changes and push them upstream to trackparent.git, this all works great. | |
5. Now lets say new files get put into or existing stuff changes in parent.git repository. | |
6. Now in trackparent.git you do | |
git remote update | |
This will update your FETCH_HEAD. | |
You create branch with this FETCH_HEAD's sha1 on trackparent.git as | |
git branch -f newbranch sha1-shown-in-FETCH_HEAD | |
7. Now in workspace where you have trackparent.git "checked-out" do | |
git pull origin newbranch | |
you should now see changes that went into parent.git in branch newbranch. | |
Now git push origin to push these changes.. | |
8. Now in workspace that had clones trackparent do | |
git checkout origin newbranch | |
Now you should see changes to trackparent via the parent.git | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment