Last active
April 28, 2026 12:38
-
-
Save pablocattaneo/830eb353080982382009f2139629c22a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Yes. Git lets you cherry-pick multiple commits in several ways. | |
| ### Cherry-pick specific commits | |
| ```bash | |
| git cherry-pick <commit1> <commit2> <commit3> | |
| ``` | |
| Example: | |
| ```bash | |
| git cherry-pick a1b2c3 d4e5f6 789abcd | |
| ``` | |
| Git applies them in the order you provide. | |
| --- | |
| ### Cherry-pick a range of commits | |
| You can cherry-pick consecutive commits using a range: | |
| ```bash | |
| git cherry-pick <start_commit>^..<end_commit> | |
| ``` | |
| Example: | |
| ```bash | |
| git cherry-pick a1b2c3^..d4e5f6 | |
| ``` | |
| That includes: | |
| * `a1b2c3` | |
| * everything after it | |
| * up to `d4e5f6` | |
| The `^` is important because ranges normally exclude the first commit. | |
| --- | |
| ### Cherry-pick without committing immediately | |
| If you want to apply multiple commits and create a single combined commit: | |
| ```bash | |
| git cherry-pick --no-commit <commit1> <commit2> | |
| ``` | |
| or | |
| ```bash | |
| git cherry-pick -n <commit1> <commit2> | |
| ``` | |
| Then create one commit manually: | |
| ```bash | |
| git commit -m "My combined changes" | |
| ``` | |
| --- | |
| ### If conflicts happen | |
| Git pauses and asks you to resolve them. | |
| After fixing conflicts: | |
| ```bash | |
| git add . | |
| git cherry-pick --continue | |
| ``` | |
| To cancel the whole operation: | |
| ```bash | |
| git cherry-pick --abort | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment