问题
I am in the process of moving all my private an public repo's over to github. One of the decisions I have made is to only use the console as it means a smaller tooling footprint if I ever need to change PCs, etc.
I would be a huge user of console applications and being new to git I decided to purchase Tekpub's Mastering Git series since it shows you how to intergrate git bash as a toolbar.
Everything is working fine except for the add all command which is:
git add .
It seems to be working but I don't get any indication of it working or not. Is there a verbose switch (I think that is what it would be called) that would say what files were tracked after the command is launched?
I am using Visual Studio 2010 with the standard install of git (Not Git extensions)
回答1:
For some git-commands you can specify --verbose
,
git 'command' --verbose
or
git 'command' -v
.
Make sure the switch is after the actual git command. Otherwise - it won't work!
Also useful:
git 'command' --dry-run
回答2:
I was debugging an issue with git and needed some very verbose output to figure out what was going wrong. I ended up setting the GIT_TRACE
environment variable:
export GIT_TRACE=1
git add *.txt
You can also use these on the same line:
GIT_TRACE=1 git add *.txt
Output:
14:06:05.508517 git.c:415 trace: built-in: git add test.txt test2.txt
14:06:05.544890 git.c:415 trace: built-in: git config --get oh-my-zsh.hide-dirty
回答3:
You can use git add -i
to get an interactive version of git add
, although that's not exactly what you're after. The simplest thing to do is, after having git add
ed, use git status
to see what is staged or not.
Using git add .
isn't really recommended unless it's your first commit. It's usually better to explicitly list the files you want staged, so that you don't start tracking unwanted files accidentally (temp files and such).
回答4:
Well, like (almost) every console program for unix-like systems, git does not tell you anything if a command succeeds. It prints out something only if there's something wrong.
However if you want to be sure of what just happened, just type
git status
and see which changes are going to be committed and which not. I suggest you to use this before every commit, just to be sure that you are not forgetting anything.
Since you seem new to git, here is a link to a free online book that introduces you to git. It's very useful, it writes about basics as well as well known different workflows: http://git-scm.com/book
来源:https://stackoverflow.com/questions/7319357/does-git-add-have-a-verbose-switch