Git Add 是否有详细的开关

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7319357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 11:48:00  来源:igfitidea点击:

Does Git Add have a verbose switch

gitgithubgit-bash

提问by deanvmc

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.

我正在将我所有的私人公共仓库转移到 github。我做出的决定之一是只使用控制台,因为如果我需要更换 PC 等,这意味着工具占用空间更小。

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.

我将成为控制台应用程序的大用户,并且是 git 的新手我决定购买 Tekpub 的 Mastering Git 系列,因为它向您展示了如何将 git bash 集成为工具栏。

Everything is working fine except for the add all command which is:

除了 add all 命令外,一切正常:

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)

我将 Visual Studio 2010 与 git 的标准安装(不是 Git 扩展)一起使用

回答by Sahil Muthoo

For somegit-commands you can specify --verbose,

对于某些git 命令,您可以指定--verbose

git 'command' --verbose

git 'command' --verbose

or

或者

git 'command' -v.

git 'command' -v.

Make sure the switch is after the actual git command. Otherwise - it won't work!

确保开关在实际的 git 命令之后。否则 - 它不会工作!

Also useful:

也有用:

git 'command' --dry-run 

回答by Aaron

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_TRACEenvironment variable:

我正在用 git 调试一个问题,需要一些非常详细的输出来弄清楚出了什么问题。我最终设置了GIT_TRACE环境变量:

export 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

回答by Riccardo T.

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.

好吧,就像(几乎)每个类 Unix 系统的控制台程序一样,如果命令成功,git 不会告诉您任何信息。只有在出现问题时它才会打印出一些东西。

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

由于您似乎不熟悉 git,这里有一个链接,指向一本免费的在线书籍,该书向您介绍了 git。它非常有用,它写了基础知识以及众所周知的不同工作流程:http: //git-scm.com/book

回答by Mat

You can use git add -ito 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 added, use git statusto see what is staged or not.

您可以使用git add -i来获取 的交互式版本git add,尽管这并不是您想要的。最简单的事情是,在git added 之后,使用git status查看什么是上演的或不上演的。

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).

git add .除非这是您的第一次提交,否则不建议使用。通常最好明确列出要暂存的文件,以免意外开始跟踪不需要的文件(临时文件等)。