Git拉后的细节变化 [英] Detail change after Git pull
问题描述
如何查看每个或某些文件的详细变化?
好的,这是我向Jefromi提出的问题:
-
我如何知道是否我正在拉高手?我所做的只是git pull。
-
Master和HEAD,Git的两个默认头像有什么不同?
-
如何查看特定文件中的详细更改?请再次看到最近一次
git pull
的汇总输出变化 -
git diff
和git whatchanged
?
假设你正在拉高手。您可以通过 master @ {1}
(甚至)来引用
;请参阅 git-rev-parse man page ),这样你就可以执行诸如 master
master@{10.minutes.ago}
-
查看所有更改:
git diff master @ {1}主人
-
查看给定目录中的所有更改:
git diff master @ {1} master< dir>
- Pro Git book
- Git Magic
- 以及Google上的450万次点击Git tutorial
How do I know if I was pulling to master? All I did is "git pull".
What does master point to and what is the difference between master and HEAD, the two default heads of Git?
How do I see the detailed change in a specific file?
How do I see the change in the summary output by the last
git pull
again?What's difference between
git diff
andgit whatchanged
?See all of the changes:
git diff master@{1} master
See the changes to a given file:
git diff master@{1} master <file>
See all the changes within a given directory:
git diff master@{1} master <dir>
See the summary of changes again:
git diff --stat master@{1} master
- The Pro Git book
- Git Magic
- and the 4.5 million hits on Google for "Git tutorial"
查看给定文件的更改: git diff master @ {1} master< file>
/ ul>
至于你的问题:我怎么知道我是否是主人?......好吧,使用分支是Git工作流的重要组成部分。你应该时刻注意你所在的分支 - 如果你拉动了变化,你想把它们拉到正确的分支!您可以使用命令 git branch
查看当前签出的所有分支的列表,并带有星号。当前分支名称也与 git status
的输出一起打印。我强烈建议浏览要使用的命令页面 - 这是慢慢获取知识的好方法。
最后一个问题: HEAD
是当前签出分支的名称。在这种情况下,你的确可以使用 HEAD
和 HEAD @ {1}
,但它对于使用分支,因为如果你去看看另一个分支。 HEAD
现在是第二个分支,而 HEAD @ {1}
现在是 master
- 不是你想要的!
为了节省大量这样的小问题,你应该看看Git教程。例如,网络上有一百万个:
After a Git pull, its output gives a summary on the change amount.
How can I see each or some of the files detailed changes?
Okay, here is my question to Jefromi:
Suppose you're pulling to master. You can refer to the previous position of master
by master@{1}
(or even master@{10.minutes.ago}
; see the specifying revisions section of the git-rev-parse man page), so that you can do things like
As for your question of "how do I know if I'm on master"... well, using branches is an important part of the Git workflow. You should always be aware of what branch you're on - if you pulled changes, you want to pull them to the right branch! You can see a list of all branches, with an asterisk by the currently checked-out one, with the command git branch
. The current branch name is also printed along with the output of git status
. I highly recommend skimming the man pages of commands to use - it's a great way to slowly pick up some knowledge.
And your last question: HEAD
is the name for the currently checked out branch. You can indeed use HEAD
and HEAD@{1}
in this context as well, but it's a bit more robust to use the branches, since if you go and check out another branch. HEAD
is now that second branch, and HEAD@{1}
is now master
- not what you want!
To save having to ask a lot of little questions like this, you should probably have a look at a Git tutorial. There are a million on the web, for example:
这篇关于Git拉后的细节变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!