起源/头部分支的用途是什么? [英] What is the use of the origin/HEAD branch?

查看:121
本文介绍了起源/头部分支的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

Git中的HEAD和ORIG_HEAD


默认情况下,我们在git中看到两个分支:

  origin / master 
origin / HEAD



我在想,头是用来做什么的?

HEAD 是一个符号引用(类似于符号链接),指向您所在的分支。你可以使用 git symbolic-ref HEAD 来获取它指向的引用。如果您切换分支(例如 git checkout branch1 ), HEAD 将指向该分支。这存储在 .git 中的文件中,如 .git / HEAD

master 是您可以使用的本地分支。如果您克隆存储库或启动新的存储库,通常会使用默认值。
$ b $ origin / master master的位置分支在远程称为原点

Possible Duplicate:
HEAD and ORIG_HEAD in Git

By default we see two branches in git:

origin/master
origin/HEAD

I wonder, what is head used for?

解决方案

HEAD is a a symbolic reference (similar to a symbolic link) that points to the branch you're on. You can get the reference it points to using git symbolic-ref HEAD. If you switch branches (e.g. git checkout branch1), HEAD will point to that. This is stored in a file in .git as .git/HEAD.

master is a local branch that you can work on. It's usually the default if you clone a repository or start a fresh one.

origin/master is the location of the master branch on the remote called origin.

这篇关于起源/头部分支的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆