Starting point: I have created a branch from master
and locally made commits. Other commits have, during my branch work, been PR'd into master
...
What I would then do, locally, is git checkout master
, git pull
, then checkout my branch and git rebase master
My understanding is that - at this point - all the commits I've made while working on my branch will be applied "after" those master
commits.
My understand of git pull --rebase
is that it does as I've described above. My question is (assuming that is correct) how does the git pull --rebase
know which branch I am rebasing on?
In the steps above I have rebased onto the HEAD
of master
, whereas most git pull --rebase
explanations appear to focus on rebasing upon commits made to the same branch (not the original master
).
My typical steps, explicitly:
git clone <path>
cd <dir>
git checkout -b feature/my-branch
<make changes>
git add .
git commit -m "some message"
git checkout master
git pull --all
git checkout feature/my-branch
git rebase master
**git push --set-upstream origin feature/my-branch**
Question: Can/Should I change the above steps to:
git clone <path>
cd <dir>
git checkout -b feature/my-branch
**git push --set-upstream origin feature/my-branch**
<make changes>
git add .
git commit -m "some message"
git pull -r