I often forgot that I have some new files and directly do,
git commit -a -m "My commit message"
This only commits changed files, and I have to do add the remaining files in a new commit. This means that there are two separate commits although logically they are part of the same task.
The easiest way I know to include untracked files in the commit via two consecutive commands:
git add -A
git commit -a -m "My commit message"
Is it possible to have the same effect like the above in one command?
git commit --amendthe previous commit once you add the untracked files?git add -Ahas this message in the man page:If no <pathspec> is given, the current version of Git defaults to "."; in other words, update all files in the current directory and its subdirectories. This default will change in a future version of Git, hence the form without <pathspec> should not be used.git add -A && git commit -a -m "my message"