Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Squashing and reorganizing commits

Tags:

git

I've seen lots of blog posts about using git commit --amend, or rebasing to squash commits.

I find it a bit easier to git reset to the last checkpoint (say before all my 'save point' microcommits) and then use interactive adding to pick out the best order of commits.

Is there a downside to this?
I'm wondering b/c as most of the blogs I read use amend or rebase for this purpose

like image 300
ambertch Avatar asked Apr 01 '11 08:04

ambertch


1 Answers

The downside is for you to pick again all the individual files in order to group them again in commits.

If your commits needs to be grouped together (without having to add or remove files in those commits), then a rebase --interactive is easier: you reason in term of set of files committed.
Actually, with the right commit comments, a rebase --interactive --autosquash can do the reordering for you.

If your commits are purely intermediate save point, without much thought as their composition in term of set of files, then your solution is adequate.

like image 174
VonC Avatar answered Sep 26 '22 17:09

VonC