Skip to content

Instantly share code, notes, and snippets.

@darkgeek
Forked from nepsilon/how-to-git-merge-commits.md
Created January 12, 2016 04:44
Show Gist options
  • Save darkgeek/8dae4a59cf1b6b5fc87e to your computer and use it in GitHub Desktop.
Save darkgeek/8dae4a59cf1b6b5fc87e to your computer and use it in GitHub Desktop.
Git merge commits
# Suppose we have this history:
$ git log --oneline
2750b94 Finally fix bug #84.
da52aaa Fix bug #84.
31f5476 Fixing bug #84.
# We enter rebasing with:
git rebase --interactive HEAD~3
# HEAD~3 says from HEAD include 3 commits
# Our editor will open with:
pick 31f5476 Fixing bug #84.
pick da52aaa Fix bug #84.
pick 2750b94 Finally fix bug #84.
# Update the file as follow:
pick 31f5476 Fixing bug #84.
squash da52aaa Fix bug #84.
squash 2750b94 Finally fix bug #84.
# Now quit and save,
# you will be prompted to enter a new commit message.
# Your new log history will be:
$ git log --oneline
38c0f13 Your new commit message about bug #84.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment