Katipo
Search  
Site Blog
  About  
  Home
About Portfolio Solutions Client Area Contact Us
: : About Us
Awards
Jobs
Our People
What Is A ... ?
Working From Home
News
Photo Gallery
Katipo Blog


Merging in single commits with Git

Sometimes it’s useful to merge in a single commit from another branch. For instance, you may want to merge a single, important bug fix from your Git master branch into a stable release branch.

You can do this using Git’s cherry-pick command.

# Merge in a single commit.
#The -n option tells Git to not commit when it’s finished the merge.
# This allows us to review and commit the changes with our own message later.
# The default commit message is very ambiguous.
$ git cherry-pick -n [The commit's SHA-1 Hash]

# Review the changes
$ git diff –cached

# Commit the changes after reviewed them
# ..with a nice, human written commit message that makes sense.
$ git commit -a -m “Your commit message (some SHA-1 Hash as a reference)”

All done! You can then push your changes to your remote repository.

Leave a Reply

You must be logged in to post a comment.


Katipo
Rachel Snowboarding