Assume
- you and your colleagues are co-developing feature that you want to share latest commits every so often without publishing to the center repo
- or on rare case: you have work done on two clones of a same repo (on same machine or different machines)
Let's say they are:
- ~/ws1/repo
- ~/ws2/repo
To setup the sharing so that you can pick commit from ~/ws1/repo to ~/ws2/repo and vice versa:
1) Setting up ~/ws1/repo:
- cd ~/ws1/repo
- git remote add ws2 ~/ws2/repo/ // Add remote repo. This is an one time setup
- git fetch ws2 // Always run this to update remote repo information
- now you can see/pick commits from remote repository:
- git log ws2/master
- git cherry-pick
- cd ~/ws2/repo
- git remote add ws1 ~/ws1/repo // Add remote repo. This is an one time setup
- git fetch ws1 // Always run this to update remote repo information
- now you can see/pick commits from remote repository:
- git log ws1/master
- git cherry-pick
git remote add ws1 user @server :~/src/repo/
git branch --set-upstream-to ws2/my_branch
