HEAD和主人之间的区别 [英] Difference between HEAD and master
问题描述
Git中的 HEAD
和 master
之间有什么区别?
我在GitHub上做了一个项目的克隆,并想将我的更改推送到远程。但我应该推哪一个?
HEAD
实际上是指向另一个引用的特殊类型的引用。它可能指向 master
,或者它可能不是(它将指向当前检出的任何分支)。如果你知道你想要提交给 master
分支,那么推送到此。
这是一个视觉示例:
在您自己的存储库中,您可以运行以下命令来检查 HEAD
指向的位置:
$ git symbolic-ref HEAD
refs / heads / master
但是,找出 remotes / origin / HEAD
指向的位置更为棘手,因为它位于远程计算机上。
这里有一个关于git引用的很好的小教程:
http://people.gnome.org/~federico/news-2008-11.html #推拉式与git-1
What is the difference between the HEAD
and master
in Git?
I did a clone of a project on GitHub and want to push my changes to the remote. But to which one should I push?
master
is a reference to the end of a branch. By convention (and by default) this is usually the main integration branch, but it doesn't have to be.
HEAD
is actually a special type of reference that points to another reference. It may point to master
or it may not (it will point to whichever branch is currently checked out). If you know you want to be committing to the master
branch then push to this.
Here is a visual example:
On your own repository you can check where the HEAD
is pointing to by running this:
$ git symbolic-ref HEAD
refs/heads/master
However, finding out where the remotes/origin/HEAD
is pointing to is more tricky because it is on the remote machine.
There is a great little tutorial on git references here:
http://people.gnome.org/~federico/news-2008-11.html#pushing-and-pulling-with-git-1
这篇关于HEAD和主人之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!