My friend is trying to help me learn to resolve conflicts in pull requests. He created a repository. I cloned it, and created a branch called "EditReadMe2". I pushed "EditReadMe2" to the repository, and he created a conflict.
I did
git checkout master
git pull
git checkout EditReadMe2
git rebase master
It warned me of a conflict which I resolved, but when I tried pushing EditReadMe2 it gave me the error.
I entered in the commands again to show my terminal in the attached image, because I don't know how its possible for the branch to be behind when I pull and rebase a second time, and it tells me everything is up to date, but then it still fails.
Force pushing solved the problem, but I want to know how to do this without using --force
.
Thanks!
The command sequence is incomplete.
After git checkout EditReadMe2
you need to perform another git pull
.
git pull
updates the working index of the current branch, not of all local branches you have.
When you issue the rebase command, you are rebasing an updated master
into your "old" EditReadMe2
branch.
Anyway the git rebase
is fine to be used in such way.
An hint:
if you are switching to master
, git pull
ing, switching back to EditReadMe2
only for the purpouse of rebasing, you can use the following sequence and save a couple of commands:
Assuming you are in EditReadMe2
git pull
git rebase origin/master
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments