How can I stage and commit all files, including newly added files, using a single command?
Stage Files to Prepare for Commit Stage all files: git add . Stage a file: git add example. html (replace example.
The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area. We also say that they will be staged.
Does
git add -A && git commit -m "Your Message"
count as a "single command"?
To have it as a git alias
, use:
git config --global alias.coa "!git add -A && git commit -m"
and commit all files, including new files, with a message with:
git coa "A bunch of horrible changes"
From git add
documentation:
-A, --all, --no-ignore-removal
Update the index not only where the working tree has a file matching but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree.
If no
<pathspec>
is given when -A option is used, all files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With