Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

Re: 'commit -a' safety

From: Miles Bader <hidden>
Date: 2016-06-15 22:48:42

Jakub Narebski [off-list ref] writes:
I'd like for 'git commit -a' to *fail* if there are staged changes for
tracked files, excluding added, removed and renamed files.  If you
have some staged changes you would get an error message:

  $ git add tracked-file
  $ git commit -a
  fatal: There are staged changes to tracked files
  hint: To commit staged changes, use 'git commit'
  hint: To commit all changes, use 'git commit -f -a' 
That's bad because of the dual nature of "git add" -- someone may
normally use "-a" most of the time to commit changes, but has really no
choice other than git add to add a new file, So with this change, their
normal (and reasonable) habits would suddenly result in failure.

I think it's sort of annoying that "git add" has such a dual meaning
(instead of, for instance, having separate "add" and "stage" commands)
-- it's one of the more confusing things about learning about git
-- but oh well, it's unlikely to get changed at this point....

-Miles

-- 
Defenceless, adj. Unable to attack.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help