From 80e1993266c95ad5ab8f85539fd7438cb4f9bdd6 Mon Sep 17 00:00:00 2001 From: S N Munendra Date: Wed, 18 May 2016 17:33:13 +0530 Subject: [PATCH] merging two commits into one. --- README.md | 6 ++++++ tips.json | 3 +++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index b08f264..c75ad48 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ * [File diff between staging and the last file version.](https://github.com/git-tips/tips#file-diff-between-staging-and-the-last-file-version) * [Extract file from another branch.](https://github.com/git-tips/tips#extract-file-from-another-branch) * [List only the root and merge commits.](https://github.com/git-tips/tips#list-only-the-root-and-merge-commits) +* [Merge previous two commits into one.](https://github.com/git-tips/tips#merge-previous-two-commits-into-one) @@ -689,5 +690,10 @@ git show : git log --first-parent ``` +## Merge previous two commits into one. +```sh +git rebase --interactive HEAD~2 +``` + diff --git a/tips.json b/tips.json index f6af834..df23a19 100644 --- a/tips.json +++ b/tips.json @@ -308,4 +308,7 @@ }, { "title": "List only the root and merge commits.", "tip": "git log --first-parent" +}, { + "title": "Merge previous two commits into one.", + "tip": "git rebase --interactive HEAD~2" }]