DEV Community

Cover image for how to merge different commit in one commit
Gaurav kushwaha
Gaurav kushwaha

Posted on • Edited on

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 ✌️

Top comments (0)