在裸回购预览更改无法正常工作 [英] Preview changes on bare repo doesn't work correctly

查看:153
本文介绍了在裸回购预览更改无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在预览更改回购之前,为什么不显示在我的克隆回购中做出的更改,如果我做了以下的事情?



git fetch



git log HEAD..origin



请参阅此主题我的工作流程已设置。
GIT - 跟踪分支与克隆之间的区别



如果我在克隆的repo中运行上述命令,它可以正常工作。我可以看到我在日志文件中所做的更改。如果我在我的笔记本电脑上运行它(初始化git的原始位置),那么在运行git log命令时我不会得到更新。我可以运行git pull,它将新的更改拉回正常状态。



是否因为我没有跟踪回购?

解决方案

好的,我在整理您所描述的工作流时遇到了一些麻烦。特别是,我不确定你是如何得到你的VPS回购的内容......但我会假设你做了它。



编辑: origin 在这种情况下实际上是origin / HEAD的同义词,因此该命令仍然可以工作,但明确指定分支通常是个好主意。如果你养成了使用 HEAD..origin 的习惯,你可以尝试在master之外的分支上使用它,然后最终有效地执行 dev.origin / master 这根本就不是你想要的!



这个问题最有可能是因为遥控器从来没有被取出,这又是由于原始远程被添加到存储库的方式。事实上,在这种情况下,git应该给出错误:

 致命:ambiguous argument'HEAD..origin':unknown revision or路径不在工作树中
使用' - '将路径与修订分开

谢谢给JakubNarębski让我直接在这里!

Ok, I'm starting to get the hang of things.

When previewing changes to a repo prior to pulling from it, why doesn't it show the changes I've made in my clone repo if I do the following?

git fetch

git log HEAD..origin

Please see this thread on how my workflow is setup. GIT - Difference between tracking a branch versus cloning

If I run the commands above in a cloned repo it works fine. I can see the changes I made in the "log" file. If I run it on my laptop (the original place where initialize git from), I don't get an update when running the git log command. I can run git pull and it pulls the new changes over just fine.

Is it because I'm not "tracking" the repo?

解决方案

Okay, I've had some trouble sorting through what you described of your workflow. In particular, I'm not sure how you got content into your VPS repo... but I'll assume you did it somehow.

Edit: origin in this case is in fact a synonym for origin/HEAD, so the command should still work, though it's often a good idea to explicitly specify the branch. If you get into the habit of using HEAD..origin you may well try to use it on a branch besides master, and then end up effectively doing dev..origin/master which is not at all what you want!

The issue was most likely because the remote had never actually been fetched, which in turn was due to the way the origin remote was added to the repository. In fact, git should give an error in this case:

fatal: ambiguous argument 'HEAD..origin': unknown revision or path not in the work tree
Use '--' to separate paths from revisions

Thanks to Jakub Narębski for setting me straight here!

这篇关于在裸回购预览更改无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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