Git

moving just single commit from branch to another branch.

Moving just single commit from branch to another branch

1024 1024 Ahmet Onur

Cherry-pick is life-saving git tool for moving just single commit from branch to another branch. To illustrate, you have to fix an issue quickly and you accidentally sent commit to develop branch and you realised that there are another commit from another developers, so you can’t open merge request from develop to master and can’t merge it immediately.

If you are sure there is no obstacle to move just fix commit to master, you can use cherry-pick to move the commit properly.

How to do “cherry-pick”?

Find commit hash

Go your commit history in git UI and get commit hash.

Switch to desired branch

Be sure you are on the branch that you want to move commit to it

git switch master

Let’s use cherry-pick

 git cherry-pick <commit-hash>

Push commit to branch

git push origin master

Congrats! 🎉 Your commit is also in master branch and great for you to deliver fix.

You can look up git cherry-pick documentation in detail here:

https://git-scm.com/docs/git-cherry-pick

Have you ever seen “.well-known” folder before? I think you already did. Let’s look together what it is