Posted by Jeff Beeman
on Wed, 07/24/2013 - 15:40
I needed a cheatsheet for some common commands I use day-to-day with git subtree. I don't intend this to be a full overview of how to use subtree, more just a reference for myself and anyone else interested.
Initial setup
Add the project as a remote
git remote add myproject-upstream [email protected]:myuser/myproject.git
Fetch the remote
git fetch myproject-upstream
Add the project
git subtree add --prefix=path/to/project myproject-upstream/master --squash
Daily work
Push to the remote project repository
git subtree push --prefix=path/to/project myproject-upstream master
Pull remote changes
git subtree pull --prefix=path/to/project myproject-upstream master --squash