Cherry-pick a Commit
Cherry picking is the act of picking a commit from one branch and applying it to another. It is mainly used when you don’t want to merge the whole branch and you just want some of the commits that were made to the branch. This operation can be useful for undoing changes, like when a commit has been accidentally made to the wrong branch. You can switch to the correct branch and cherry-pick the commit to where it should belong.
To cherry-pick a commit in a merged MR:
Use the Git Command Line as an Alternative to the VB Studio Git User Interface
You can use the Git command line instead of using VB Studio's Git user interface to cherry-pick a commit in one branch and add it to another.
git cherry-pick
command is relatively
straightforward:git cherry-pick <commit-ID>
where
<commit-ID>
is a commit reference.
You need to use the git log
command to find a command reference.
There are several options you can use with git log to format and filter the results.
For example, you could use the --graph
option to draws an ASCII
graph that represents the commit history's branch structure. This option is often
used with the --oneline
and --decorate
commands so
you can see which commit belongs to which branch. The --decorate
flag makes the git log
command display all of the references, such
as branches, tags, and so on, that point to each commit.
You can also use the Git command line to create a merge request, when one is needed. See Create a Merge Request from the Command Line.