Sorry, this maybe a stupid question, but I just couldn't figure it out the problem.
I have cloned a branch via git (bitbucket), changed some files, commited these and pushed them back to the remote origin.
Now I want to push this commit to a different branch which is partly ahead and behind of the current branch. So I tried: git push origin HEAD:differentBranch
, but this didn't work ("Updates were rejected because a pushed branch tip is behind its remote counterpart").
How can I fix this? Sorry again, my skills in git are still developable.
You can do that by using git cherry pick. So you can try like this:
git checkout differentBranch
git cherry-pick <commit # from previous commit from your first branch>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With