因此,这已在其他地方问过,但我看到的答案似乎对我不起作用。
我有一个裸远程存储库,“起源”。我在本地工作,在一个名为“ect010”的分支中,远程也有,它被跟踪:
git remote show origin
* remote origin
Fetch URL: /projects/ECT/bareChain.git
Push URL: /projects/ECT/bareChain.git
HEAD branch: master
Remote branches:
develop tracked
ect010 tracked
master tracked
oldXML tracked
Local branch configured for 'git pull':
ect010 merges with remote ect010
Local ref configured for 'git push':
ect010 pushes to ect010 (local out of date)
Run Code Online (Sandbox Code Playgroud)
远程 ect010 分支比我的本地 ect010 分支有更多最近的提交(如果我去裸目录并做一个 git 日志,我可以看到这些提交)。
知道这一点,我从我当地的 ect010 分支做:
git fetch origin ect010
Run Code Online (Sandbox Code Playgroud)
这似乎没有多大作用:
From /projects/ECT/bareChain
* branch ect010 -> FETCH_HEAD
Run Code Online (Sandbox Code Playgroud)
..最后,我想看看我的本地 ect010 和远程 ect010 之间的差异,所以我试过了
git log origin/ect010
Run Code Online (Sandbox Code Playgroud)
但这显示了与我的本地日志相同的日志,没有显示我知道的最新提交是裸露的。为什么?显然我做错了什么,但正如我在其他一些帖子中看到的那样,这种技术应该有效......不是吗?
我很感激任何帮助!非常感谢,
阿诺
编辑:(因为我也在其他答案中看到了这个建议,但在我的配置中似乎没问题)
正在做
git config --get remote.origin.fetch
Run Code Online (Sandbox Code Playgroud)
给出:
+refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)
..这看起来不错,对吧?
当你这样做时,git fetch origin ect010它将分支提取到一个名为 的特殊引用中FETCH_HEAD,它不会更新remotes/origin/*分支。你看它告诉你:
From /projects/ECT/bareChain
* branch ect010 -> FETCH_HEAD
Run Code Online (Sandbox Code Playgroud)
只要这样做git fetch origin,它就会根据+refs/heads/*:refs/remotes/origin/*模式进行提取。
顺便说一句,如果您只想获取该单个分支,则必须:根据上述模式指定全名和映射。IE
git fetch origin refs/heads/ect010:refs/remotes/origin/ect010
Run Code Online (Sandbox Code Playgroud)
但老实说,我看不出你有什么理由需要这个。把所有东西都拿走。