Git: merge commit into another branch

So, I have 3 branches;

  • develop - my branch of continuing development
  • version_1 - branch of liberation
  • version_2 - branch of liberation

I had to make a fix on version_2to reinstall this version, it was a 2-line change in 2 files, very small.

I wanted to apply this fix to version_1and develop.

So me;

git checkout version_1
git merge <commit checksum>

I thought that commit only contains changes, so only those apply. But the merge conflicts because it tries to update all the changes between the two branches.

Is there a way to merge / move / apply ONLY changes in a small commit to other branches?

, , , , .

Cheers, Will
+1
2

git cherry-pick

, : . Git merge?".
:

git checkout version_1
git cherry-pick <commit checksum>

: . " .

+2

cherry-pick, .

, :

git checkout develop

cherry-pick commit. git reflog SHA-1 .

, develop, cherry-pick it

git cherry-pick <commit SHA obtained above>

version_1.

+2

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


All Articles