T
T
Taron4uk2019-12-09 11:59:22
git
Taron4uk, 2019-12-09 11:59:22

How to push changes from one branch to another?

Good afternoon, tell me, please, how to transfer changes from one branch to another?
If it's not difficult - describe how you need to write in the console, otherwise I'm just learning how to work with the git.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maks Kovyvchak, 2019-12-09
@Taron4uk

take the hash of the commit (you can find it using the git log command) that you need to move to another branch, then switch to the desired branch and enter git cherry-pick <commit hash>, for example git cherry-pick 3ea6207fe84 and you will be good

T
tsarevfs, 2019-12-09
@tsarevfs

Maks Kovyvchak's solution is correct , but only in case you need to get or push one or more commits, but not all.
A more typical situation is when the work done in a separate branch needs to be completely poured into another. In gitflow, all commits go through this.
https://bitworks.software/2019-03-12-gitflow-workf...
To do this, use the git merge command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question