Assume that my local repository is one commit behind the repository at github.
Then I commit one commit at the local repository
At this time
A------>commit 1 Github/master
A------>commit 2 local repository/master
I do the following steps to push commit 2 to github:
- git fetch origin master
- git rebase origin/master
- git push origin master
But I got the following errors:
If I try to replace step 1 with git fetch origin, it works well
Then I tried git fetch origin master:tmp, a branch named tmp successfully created
So, My question is
why git fetch origin master sometimes works(in the case git fetch origin master:tmp), while sometimes not work in the case step 1?