Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 6
    This was actually the most helpful answer for me, because it didn't require manual rebasing, but instead just squashes all commits of a whole branch into one commit. Very nice. Commented Aug 26, 2015 at 19:50
  • Thanks for this! This is how to make git do how I picture squashing commits in my head! Commented Aug 1, 2016 at 7:09
  • amazing answer, so much simpler than the alternatives Commented Feb 17, 2017 at 19:00
  • Apparently, this answer is not suitable for the case when a and c requires to be merged together and keep b as it is. Commented Jan 29, 2018 at 9:41
  • @TalhaAshraf It's pretty clear that this thread discusses squashing consecutive commits. In the case of non-consecutive commits, you can reorder the commits before squashing (as long as they are not dependent on each other). See stackoverflow.com/questions/3921708/… Commented Sep 18, 2024 at 8:19