Git push commit to another branch

Sorry, this might be a dumb question, but I just couldn't figure out what the problem was.

I cloned the branch via git (bitpack) , changed some files, committed them and pushed them back to the remote start.

Now I want to push this commit to another branch, which is partially in front and behind the current branch. So I tried: git push origin HEAD:differentBranchbut it didn’t work ("Updates were rejected because the branch responder clicked behind its remote partner").

How can i fix this? Sorry again, my git skills are still evolving.

+4
source share
1 answer

, git cherry pick. :

git checkout differentBranch
git cherry-pick <commit # from previous commit from your first branch>
+6

Source: https://habr.com/ru/post/1610591/


All Articles