$ git --version
git version 2.5.3
$ git branch
* feature/branchABC
$ git status -b branchABC
On branch feature/branchABC
Your branch is up-to-date with 'origin/feature/branchABC'.
nothing to commit, working directory clean
$ echo "abc" > abc.cpp
$ git status -b branchABC
On branch feature/branchABC
Your branch is up-to-date with 'origin/feature/branchABC'.
nothing to commit, working directory clean
Question> After I add a new file abc.cpp
in the current folder, why I still see the message 'working directory clean` in git?
Thank you
--Update One--
$ git status
On branch feature/branchABC
Your branch is up-to-date with 'origin/feature/branchABC'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
abc.cpp
nothing added to commit but untracked files present (use "git add" to track)
the command git status
doesn't require an argument. The argument branchABC
that you provided is interpreted by git-status
as a path. So git checks the status of a file or directory named branchABC
. Solution: just use one of the following commands:
git status
git status -b
in the git-status
man page: git status [<options>...] [--] [<pathspec>...]
, and since branchABC
is not a valid option; it is interpreted as pathspec
. I agree that maybe git could have put a warning that there is nothing matching the path branchABC
...
I tested this locally.
$ git status
# On branch test
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# spec/a
# src/a
$ git status src
# On branch test
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# src/a
$ git status non-existing-path
# On branch test
nothing to commit, working directory clean