2

git add --all or git add -A followed by git commit -m "commit message" seem to produce a different result from git commit -am "commit message" when I thought they would produce the same final result.

Am I doing something wrong with git commit -am "commit message"?

Also is git commit -a -m "commit message" the same as git commit -am "commit message"?

1 Answer 1

4

More generally, I always recommend to add first, check the status, and then commit.
I find that extra step a good opportunity to:

  • check that nothing had been forgotten for the next commit
  • check that no extra elements are added for the next commit (which shouldn't be part of it, being not ready)
  • polish the commit message (I usually git commit -f file)

And yes, git commit -a -m "commit message" is the same as git commit -am "commit message".

Sign up to request clarification or add additional context in comments.

1 Comment

unix.stackexchange.com/questions/13573/… is an interesting read regarding unix-style for parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.