Menu

gitpiper

Merge a branch and create a merge commit git Code Snippet in 2025

repositorybranchintermediate

Last Updated: 22 April 2025

Merges a branch into the current branch, creating a merge commit.

  • Use git checkout <target-branch> to switch to the branch into which you want to merge.
  • Use git merge --no-ff -m <message> <source-branch> to merge a branch into the current branch, creating a merge commit with the specified <message>.
git checkout <target-branch> git merge --no-ff -m <message> <source-branch>
git checkout master git merge --no-ff -m "Merge patch-1" patch-1 # Merges the `patch-1` branch into `master` and creates a commit # with the message "Merge patch-1"

git snippet similar to Merge a branch and create a merge commit For You in April 2025

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2025 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️