Re: how to squash two commits into only one
On Tue, 2011-03-29 at 06:12 -0700, Joshua Juran wrote:
Show 23 quoted lines
> 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@gmail.com>
> > 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@gmail.com>
> >>> 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. ............................................
I like this idea. It's been in my notes for a while, but seems like it has a lot of potential to make existing scripts noisy for no reason. I do agree with the change, however.
The only constructive thing I'd add, as it's sitting in my notes right
next to "Warn if "git commit --amend" introduces no changes":
- Add "git commit --reword", like --amend, but without the above
warning
This would fit in with the existing names from "git rebase -i". --fixup (for "like --amend but do not ask for a message") seems like a sensible addition to those to, also following the lead of rebase -i, but --fixup=<commit> already means something different (though related), so it is probably a bad idea to overload --fixup with no =<commit>.
Show 16 quoted lines
> ........................ 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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html