Created
December 11, 2011 20:28
-
-
Save kbarber/1462570 to your computer and use it in GitHub Desktop.
Git subtree experiment
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
Two projects: | |
a | |
subproject | |
Enter the 'a' directory and add a remote: | |
% cd a | |
% git remote add subproject ../subproject | |
% git remote -v | |
subproject ../subproject (fetch) | |
subproject ../subproject (push) | |
% | |
Fetch the subproject project and create a branch for it: | |
% git fetch subproject | |
% git branch -r | |
subproject/master | |
% git checkout -b subproject subproject/master | |
Switch back to master and merge in subproject: | |
% git read-tree --prefix=subproject/ -u subproject | |
Then commit the changes in: | |
% git commit -a | |
To pull in new commits: | |
% git checkout subproject | |
% git pull | |
% git checkout master | |
% git merge --squash -s subtree --no-commit subproject | |
Squash commit -- not updating HEAD | |
Automatic merge went well; stopped before committing as requested | |
Then commit: | |
% git commit -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment