Re: [Qgit RFC] commit --amend

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

 



Jan Hudec <bulb@xxxxxx> writes:

>> P.S: Why 'git-commit --amend -F' it's explicitely forbidden?

The reasoning goes like this (here, I am not particularly trying
to justify it, but am merely explaining the original reasoning
and intended use case as a historical background):

    To amend means to remove the tip commit, replace with a new
    one, possibly but not necessarily with a different tree from
    the removed one.

    Since you are "amending", the spirit of the commit you are
    going to create, in order to replace the old one, ought to
    be the same as the one being replaced.

    - You may be only adding a change that you forgot to add
      before making the previous commit (in which case your tree
      is slightly different, but what you are going to say in
      the commit log message is exactly the same), or

    - you may found a typo in the commit log message and trying
      to fix it (in which case your tree is identical but the
      commit log message would be slightly different).

    In either case, the resulting commit log message would be
    very similar to the existing one, so the tool helps you by
    letting re-use and re-edit the commit log message instead of
    forcing you to re-type it.

There is no room for -F, -c, nor -m to make sense for these use
cases, and giving them to "commit --amend" is most likely a user
error, and diagnozed as such, because "commit --amend" is an
end-user level Porcelain program.

If you are popping one commit and replacing with a totally
**unrelated** commit, that is not what --amend is about.  What
you are doing is "reset --soft HEAD^" followed by "add <something>"
followed by "commit".

At the mechanical level, you could argue that --amend is doing
the same thing.  After all, that reset/add/commit sequence is
exactly what is done by --amend internally.

But if a Porcelain like StGIT or Qgit would want to do that kind
of operation for different use case than "amending", it can and
should use plumbing commands, just like the implementation of
"commit --amend" does, with different constraints and error
checks.



-
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]

  Powered by Linux