有没有办法通过运行某些git
命令并检查其退出代码来判断是否正在跟踪文件?
换句话说:是git跟踪文件?
我有两个简明的问题:
注意: 我知道我可以进行初始提交以跟踪文件,并从那里开始跟踪我的文件.但有可能专门做我上面提到的问题吗?
我尝试使用git add -N <expr>
但它跟踪文件并添加它以进行提交:
PS C:\> git add -N fileA
PS C:\> git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: fileA
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
# modified: composer.lock …
Run Code Online (Sandbox Code Playgroud) git ×2