What does git cherry-pick do?

What does git cherry-pick do?

a) Applies a specific commit from one branch to another
b) Deletes a specific commit
c) Creates a new branch
d) Reverts changes made in a commit

Answer:

a) Applies a specific commit from one branch to another

Explanation:

The git cherry-pick command applies the changes from a specific commit to the current branch. This allows you to take one or more commits from another branch and apply them individually, without merging the entire branch.

For example, running git cherry-pick abc123 will apply the commit with hash abc123 to the current branch.

This command is useful for selectively bringing changes into a branch, especially when you only need certain updates or fixes from another branch.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top