My workflow:
$ git remote -v
origin [email protected]:abc/dev.git (fetch)
origin [email protected]:abc/dev.git (push)
upstream [email protected]:companyname/dev.git (fetch)
upstream [email protected]:companyname/dev.git (push)
Fork [email protected]:companyname/dev.git using github web interface. Create [email protected]:abc/dev.git
Now:
1. git clone [email protected]:abc/dev.git
2. git remote add origin [email protected]:abc/dev.git
3. git remote add upstream [email protected]:companyname/dev.git
4. git checkout -b upstream-master upstream/master
5. git checkout -b master origin/master
Now modify some code and create a commit on local master branch.
5.1. git add somecode.c
5.2. git commit -m "my commit for which I will make a PR"
6. git push origin master
Now go to [email protected]:abc/dev.git
on github web interface and create a PR for upstream/master:
Once the PR is merged, do:
7. git checkout upstream-master
8. git pull --rebase
Now my local upstream-master
has PR merge commit but master
(which is origin/master) does not.
Q: Which branch should I rebase on which and why ?
After steps 7 and 8 should I do
git rebase origin-master
or should I do
git checkout origin-master
git rebase upstream-master