Information Technology Reference
In-Depth Information
$ git status -s will be:
_M modified.txt
4. Commit the changes with:
$ git commit -a -m "Committing modified file:
modified.txt"
5. Check the status with $ git status -s
The output is empty, thus the repository is clean.
How It Works
We know from Recipe 4-2 that an unmodified file (i.e. a file that was committed and
was not modified since then) after the modification becomes unstaged. We can commit
all unstaged files with one command:
$ git commit -a -m "Some comment..."
The flag -a tells git to include in the commit unstaged files. (Do you remember?
All unstaged files are tracked!) Notice that using this solution you can not choose
which files will go into the commit. The command:
$ git commit -a -m "..."
will commit all staged and unstaged files. If you want to commit one unstaged file you
can pass its name to the $ git commit command as this:
$ git commit -m "Some text..." -- [filename]
Hint The command $ git commit -m "..." creates a new revision contain-
ing all the staged files. The unstaged and untracked files are not modified by this com-
mand. The command $ git commit -a -m "..." creates a new revision con-
Search WWH ::




Custom Search