DEV Community

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

Posted on • Edited on

2 2

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)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay