裸仓库为什么有HEAD [英] why does bare repository have HEAD

查看:91
本文介绍了裸仓库为什么有HEAD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道裸仓库中 HEAD 的用途是什么?是否只有在克隆存储库时才知道要在克隆存储库中检出哪个分支?



请注意,这个问题不是关于什么是HEAD ,但给它的函数,我想知道为什么它需要在 bare repository中。



$

您可以说出一个HEAD用于裸仓库的情况吗? b $ b

请参见 t / t1430-bad-ref-name.sh



您可以进行软复位在裸露的repo中,这意味着您可以移动HEAD(当前提交),这是更改默认分支的一种方式。 。

这意味着当你克隆一个裸回购时,在非裸克隆中签出的默认分支将是由裸露的回购HEAD。

I'm wondering what's the purpose of HEAD in bare repository? Is it just used when repository is cloned to know which branch to checkout in cloned repository?

Please note, this question is not about what is HEAD, but given its functions I'm wondering why it's needed inside bare repository.

解决方案

Can you please name a case where HEAD is used in a bare repository?

See "t/t1430-bad-ref-name.sh"

You can do a soft reset in a bare repo, which means you can move HEAD (current commit) around, which is one way to change the default branch.

That means that when you clone a bare repo, the default branch checked out in the non-bare clone will be the one referenced by the bare repo HEAD.

这篇关于裸仓库为什么有HEAD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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