how to merge different commit in one commit

heykush

Gaurav kushwaha

Posted on July 2, 2022

how to merge different commit in one commit

Steps to do:

  1. Get the log after which you want to merge all commit
git log
Enter fullscreen mode Exit fullscreen mode
  1. Rebase that commit
git rebase -i <commit id>
Enter fullscreen mode Exit fullscreen mode
  1. It will show all commit above the commit we pick to rebase

  2. Now, have to squash commit in one commit and for that pick one commit and other's are to squash in that commit(means merge all commit in that pick commit)

git rebase

  1. Git log can also view in oneline
git log --oneline
Enter fullscreen mode Exit fullscreen mode
  1. Now on exit, it ask you to commit a message, do that and exit with :x
  2. Done. Check your log now ✌️
💖 💪 🙅 🚩
heykush
Gaurav kushwaha

Posted on July 2, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related