git cherry-pick should be your answer here.

Apply the change introduced by an existing commit.

Do not forget to read bdonlan's answer about the consequence of cherry-picking in this post:
"Pull all commits from a branch, push specified commits to another", where:

A-----B------C
 \
  \
   D

becomes:

A-----B------C
 \
  \
   D-----C'

The problem with this commit is that git considers commits to include all history before them

Where C' has a different SHA-1 ID.
Likewise, cherry picking a commit from one branch to another basically involves generating a patch, then applying it, thus losing history that way as well.

This changing of commit IDs breaks git's merging functionality among other things (though if used sparingly there are heuristics that will paper over this).
More importantly though, it ignores functional dependencies - if C actually used a function defined in B, you'll never know.

Answer from VonC on Stack Overflow
🌐
DEV Community
dev.to › iamafro › how-to-merge-a-specific-commit-into-another-branch--oak
How to merge a specific commit into another branch - DEV Community
February 15, 2018 - First you checkout the branch you want to merge the commits into ... What this does is, "It applies the change introduced by the commit at the tip of the working branch and creates a new commit with this change". The issue I had with that was, I had made a couple of commits and I needed all those commits in the master branch. That's when I found it. What did I find? you may be asking. Gitlens is what I found.
Discussions

How to merge branches to a specific commit
git switch main; git merge 1.0.1 —ff-only; More on reddit.com
🌐 r/git
5
6
January 14, 2021
git - Merge up to a specific commit - Stack Overflow
I created a new branch named newbranch from the master branch in git. Now I have done some work and want to merge newbranch to master; however, I have made some extra changes to newbranch and I want to merge newbranch up to the fourth-from-the-last commit to master. More on stackoverflow.com
🌐 stackoverflow.com
git - How to merge specific commit id from different branch in same repo - Stack Overflow
I had two branches master & trunk. I have created one more branch in local using git checkout -b new_branch origin/master to take the master code in that branch. I have added committed some c... More on stackoverflow.com
🌐 stackoverflow.com
How do we rebase changes from the `main` branch to the `feature` branch?
You have it backwards. You need to do git checkout featureand then git rebase main. More on reddit.com
🌐 r/git
12
12
March 31, 2022
🌐
Git
git-scm.com › docs › git-merge
Git - git-merge Documentation
This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus). With --no-squash perform the merge and commit the result. This option can be used to override --squash. With --squash, --commit is not allowed, and will fail. ... By default, the pre-merge and commit-msg hooks are run. When --no-verify is given, these are bypassed. See also githooks[5]. ... Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried.
🌐
Better Stack
betterstack.com › community › questions › how-to-merge-specific-commit
How to Merge a Specific Commit in Git | Better Stack Community
August 12, 2024 - Use the cherry-pick command to apply the changes from the specific commit onto the current branch. ... Replace <commit-hash> with the hash of the commit you want to apply. If the commit being cherry-picked causes conflicts with the current branch, ...
🌐
Reddit
reddit.com › r/git › how to merge branches to a specific commit
r/git on Reddit: How to merge branches to a specific commit
January 14, 2021 -

I have two branches, main and develop. Lets say that this is my current commit history:

A - B - C - D (main) (tag 1.0.0) - E - F - G (tag 1.0.1) - H (develop)

I want to bring main to G (tag 1.0.1) so that it is one commit behind develop. Note that, I want all commits between main and G to also be included. Would I use cherry-pick or is there a better way?

🌐
Matt Stauffer
mattstauffer.com › blog › how-to-merge-only-specific-commits-from-a-pull-request
How to merge only specific commits from a pull request with git cherry-pick | MattStauffer.com
Git's cherry-pick command allows you to "cherry pick" only the commits you want from another branch. ... Pull down the branch locally. Use your git GUI or pull it down on the command line, whatever you'd like.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › git › how-to-merge-commits-in-git
How to Merge Commits in Git? - GeeksforGeeks
July 23, 2025 - ... This method allows you to merge all changes from a branch but combine them into a single commit. ... git checkout main git merge --squash feature git commit -m "Merged feature branch as a single commit"
🌐
Git
git-scm.com › book › en › v2 › Git-Branching-Basic-Branching-and-Merging
Git - Basic Branching and Merging
Instead of just moving the branch pointer forward, Git creates a new snapshot that results from this three-way merge and automatically creates a new commit that points to it.
🌐
Namehero
namehero.com › blog › using-git-cherry-pick-to-apply-a-commit-from-another-branch
Using Git Cherry-Pick To Apply A Commit From Another Branch
October 30, 2024 - The cherry-pick command allows you to pick a specific commit from another git branch and bring it into your current branch. ... The cherry-pick sub-command in git is used to apply a single commit from one branch and apply it to the current branch ...
🌐
Better Stack
betterstack.com › community › questions › how-to-selectively-merge-or-pick-changes-from-another-branch-in-git
How Can I Selectively Merge or Pick Changes from Another Branch in Git? | Better Stack Community
Check out specific files: Check out specific files or directories from other-branch-name into your current branch: ... Replace path/to/file1 path/to/dir1 with the paths to the files or directories you want to bring in. Commit Hash: Always verify the commit hash or reference of the changes you want to pick or merge. Conflicts: Be prepared to resolve conflicts when merging or applying changes. Branch Switching: Use git checkout to switch between branches as necessary before executing commands.
🌐
LinkedIn
linkedin.com › pulse › how-merge-only-specific-commits-from-pull-request-branch-asad-shakil
How to merge only specific commits from a pull request into the branch you are checked in
August 28, 2020 - Open the commit in GitHub and copy the long hash of the commit that you want to merge. ... Now, the commit should be available to your current branch and you can push it to your master branch with git push origin master.
🌐
Codemia
codemia.io › home › knowledge hub › how to merge a specific commit in git
How to merge a specific commit in Git | Codemia
January 2, 2025 - Git is a distributed version control system used widely by developers for managing the source code. It allows multiple developers to work on the same project simultaneously without interfering with each other's work. One of Git's powerful features is the ability to selectively merge specific commits from one branch into another.
🌐
Microsoft Learn
learn.microsoft.com › en-us › visualstudio › version-control › git-manage-repository
Manage Git repos in Visual Studio | Microsoft Learn
To learn more about merging, rebasing, and branching in general, see Git Branching on the Git website. Copy commits from one branch to another by using the cherry-pick option. Unlike a merge or rebase, cherry-picking brings only the changes from the commits that you select, instead of all the ...
🌐
GitLab
docs.gitlab.com › ee › user › project › merge_requests › cherry_pick_changes.html
Cherry-pick changes | GitLab Docs
October 18, 2022 - In Git, cherry-picking is taking a single commit from one branch and adding it as the latest commit on another branch. The rest of the commits in the source branch are not added to the target. Cherry-pick a commit when you need the contents in a single commit, but not the contents of the entire ...
🌐
Git Tower
git-tower.com › learn › git faq › how to merge branches in git with git merge
git merge - Integrating changes from another branch
1 week ago - Merge a branch into your current branch with git merge. Covers fast-forward merges, no-fast-forward merges, and resolving merge conflicts.