So the command to stage all changes for git is git add -A.
Is there a way to execute this from within a repository subdirectory, and capture all changes anywhere in the repo, without having change the directory back to the repo root?
Example:
$pwd
/reporoot/
modify the file: /reporoot/a-file
$cd /a-subdir
$git 'magic variation of add -A which I'm looking for'
and the change to /reporoot/a-file will be staged.
I find that I’m often in one place in the terminal, but editing a file somewhere else with the IDE, so the answer to this question would be a helpful way for avoiding lots of cd’ing.
Use the following (only works in newer versions of Git):
You may wish to create a Git alias for this to make running it easier.
Note that, if you plan on committing, doing the following will stage all changed files already in the working tree (i.e., not untracked files):