Re: how to squash two commits into only one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mar 29, 2011, at 5:49 AM, Nguyen Thai Ngoc Duy wrote:

On Tue, Mar 29, 2011 at 7:44 PM, Joshua Juran <jjuran@xxxxxxxxx> wrote:
On Mar 29, 2011, at 3:58 AM, Alex Riesen wrote:

On Tue, Mar 29, 2011 at 12:10, Lynn Lin <lynn.xin.lin@xxxxxxxxx> wrote:

only have two commits

Than yes, "git reset HEAD^; git commit --amend" seems the best solution.

Actually, that should be: `git reset --soft HEAD^; git commit -- amend`.

"git rebase --root" does not seem a bad idea though. I need to amend
initial commit a few times and end up using "git reset" without
--soft.

Or perhaps have `git commit --amend` issue a warning if doesn't actually amend anything. Sometimes you just want to change the commit message, so you wouldn't want a warning in that case. But other times you're adding changes and updating the commit message at the same time, so you'd want a warning if you forgot to git-add or use --soft. A new --fix option to commit could work like --amend, but fail with an error if no changes are staged. Another option is for --amend to list the staged changes in the edit buffer, or a warning when nothing has changed.

Josh


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]