Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cherry pick from 1 branch to another

When you cherry-pick, it creates a new commit with a new SHA. If you do:

git cherry-pick -x <sha>

then at least you'll get the commit message from the original commit appended to your new commit, along with the original SHA, which is very useful for tracking cherry-picks.


If you're an IntelliJ user, it's pretty simple. Here, I am cherry-picking a commit from master branch to give-me-commit-branch. Note a few points in the below pic:

  • destination: The current checkout branch is give-me-a-commit-branch. Denoted by tag icon.
  • source: The selected master branch whose commit logs are displayed on the right side is the source of the commit.
  • searching ability: Using the search (lens icon) option, we can find the revision number.
  • multiple-selections: At a time, we can select multiple commits and cherry-pick them at one go!

This is easy-to-use and transparent.

enter image description here