git“更新当前检出分支”是什么?警告的意思? [英] What does git "updating currently checked out branch" warning mean?

查看:1433
本文介绍了git“更新当前检出分支”是什么?警告的意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 警告:更新当前签出的分支;这可能会引起混淆,
作为索引,工作树不会反映现在在HEAD中的更改。

我对此邮件进行了Google搜索,所有我能找到的都是 git邮件列表讨论作者试图准确地决定如何更好地传达这条信息以便与我交流真正的问题是什么。



我是如何造成这种情况的,我该如何解决它?

解决方案

这种情况发生在您推送非裸露回购时。裸仓库是一个完全由 .git 目录组成的仓库,非裸回购还包括结账。一般情况下,你不应该推到非裸回购;实际上,在未来的git版本中,这将被禁止。如果你推到一个非裸回购,那么回购的HEAD将与索引和工作副本不同步。



如果您正在创建一个repo人们将要推入,那么你应该使用 git init --bare (和 git init --bare - 如果多个用户帐户需要访问它,共享),或者 git clone --bare ,如果您通过克隆现有回购来创建它。 / p>

When I do a git push, I see the following:

warning: updating the currently checked out branch; this may cause confusion,
as the index and working tree do not reflect changes that are now in HEAD.

I Googled for this message, and all I can find is a git mailing list discussion where the authors try to decide exactly how to make this message better to communicate to me what the real problem is.

How did I cause this, and how do I fix it?

解决方案

This happens when you are pushing to a non-bare repo. A bare repo is one that consists solely of a .git directory; a non-bare repo also includes a checkout. In general, you should not push to a non-bare repo; in fact, in future version of git, that will be forbidden. If you push to a non-bare repo, then the HEAD of that repo will be out of sync with the index and the working copy.

If you're creating a repo that people are going to want to push to, then you should create it using git init --bare (and git init --bare --shared if several user accounts need access to it), or git clone --bare if you're creating it by cloning an existing repo.

这篇关于git“更新当前检出分支”是什么?警告的意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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