Reputation: 7478
I have forked a public repo(R). And then cloned this fork(F) to my local machine(L).
So to start with, L and F are in sync. Then I made a commit in L and tried to push it to F.But R has meanwhile gone ahead, so git didn't allow me to do so. So I pulled changes from R, and merged them. But now trying to push to F gives me error:
Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again.
I am not sure what can I do here. I can see in graph that tip of my current branch is head of origin/master.How can then it be behind its remote counterpart?
Upvotes: 1
Views: 140
Reputation: 1323993
The way you would work on a fork is by creating a dedicated branch:
git clone yourFork L
cd L
git checkout -b myBranch
# work and commit
git push -u origin myBranch
(no problem with "branch behind counterpart" here)
Then, you might want to make sure the original repo has not evolved in the meantime:
git remote add upstream /url/original/repo
git fetch upstream
git checkout myBranch
git rebase upstream/master
git push --force
Upvotes: 1