Add as if from the root folder of the repository
You can use git add -A :/
.
A pathspec which starts with a colon tells git that it should interpret the remainder of that pathspec from the base of the repository rather than from the current directory. Followed by just a slash it will refer to the root of the repository, causing git add
to add all changes.
This appears to require git 1.7.6 or newer.
Since my other answer requires a newer version of git, here's an alternative that will hopefully work with older versions.
Aliases where the expansion starts with an exclamation mark are treated as separate shell commands, and they are defined as executing in the top level of the repository. So you could define such an alias and use that in place of git add
:
git config --global alias.addroot '!git add'
git addroot -A
Or you could include the -A
option in the alias.
git commit -a -m commit_msg
will do what you want. Note that with this command, the -a
flag does the adding, so don't do a separate git add
before the commit.