git-svn fetch 没有引入最新版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7195275/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git-svn fetch isn't pulling in the latest versions
提问by Starkii
When I execute a
当我执行一个
git svn fetch
git svn fetch
from my repository, it returns nothing and doesn't update even though there are new commits under svn.
从我的存储库中,即使 svn 下有新的提交,它也不会返回任何内容并且不会更新。
[root]# svn log -l 1 http://example.com/trunk/client-resources/resource-pa
r12958 | ing | 2011-08-22 18:29:57 -0500 (Mon, 22 Aug 2011) | 1 line
SRGENERAL-1468 adding more arrays for pa
[root]# git-svn fetch
[root]# git log -1
commit be19ae4c7d1a3c3da6dd90389aebd6d76792cc71
Author: sltin <sltin@44b83e5a-25ef-0310-8dbe-ee0aa4f92a64>
Date: Wed Jun 22 14:30:53 2011 +0000
Fixing the classpath.
git-svn-id: http://example.com/trunk/client-resources/resource-common@12406 44b83e5a-25ef-0310-8dbe-ee0aa4f92a64
Note the version differences. The svn log lists 12958 and the git log lists the latest svn version as 12406.
注意版本差异。svn 日志列出了 12958,git 日志列出了最新的 svn 版本为 12406。
I can do a reset to 12406 and then a new fetch:
我可以重置为 12406,然后重新获取:
[root]# git svn reset 12406
r12406 = be19ae4c7d1a3c3da6dd90389aebd6d76792cc71 (refs/remotes/git-svn)
[root]# git svn fetch
M src/test/java/csl/resource/ioc/AbstractResourceIocTest.java
r12977 = 1b21f560b0354b28fe1a272d7723b1e6fa90a99c (refs/remotes/git-svn)
M src/test/java/csl/resource/ioc/AbstractResourceIocTest.java
r12978 = bf22ea0151a364eb1ca1af37a7a907d5b5cc7420 (refs/remotes/git-svn)
M src/test/java/csl/resource/ioc/AbstractResourceIocTest.java
r12987 = ce922c2eae07f6c12dbbd4175a9c61055b563ee3 (refs/remotes/git-svn)
And when I check the log versions, they are unchanged.
当我检查日志版本时,它们没有变化。
How do I get git-svn to pull in the latest versions from svn?
如何让 git-svn 从 svn 中提取最新版本?
Edit:
编辑:
I found the answer, the svn data is loaded in to an inactive thread that would normally be merged in to the active branch, which doesn't exist in a bare repository. I tried to do a reset, but that needs an active branch too. The final answer was:
我找到了答案,svn 数据被加载到一个非活动线程中,该线程通常会合并到活动分支中,而活动分支在裸存储库中不存在。我试图进行重置,但这也需要一个活动分支。最后的答案是:
git reset --soft refs/remotes/git-svn
采纳答案by Starkii
I found the answer, the svn data is loaded in to an inactive thread that would normally be merged in to the active branch, which doesn't exist in a bare repository. I tried to do a reset, but that needs an active branch too. The final answer was:
我找到了答案,svn 数据被加载到一个非活动线程中,该线程通常会合并到活动分支中,而活动分支在裸存储库中不存在。我试图进行重置,但这也需要一个活动分支。最后的答案是:
git reset --soft refs/remotes/git-svn
回答by knittl
git svn fetch
only copies new revisions to your local object database, very much like git fetch
– both only synchronize object databases. It will not update your branch and working copy. To get the newly fetched changes into your branch, use git svn rebase
; it will re-apply all your local changes on top of the latest svn revision.
git svn fetch
只将新修订复制到本地对象数据库,非常像git fetch
- 两者都只同步对象数据库。它不会更新您的分支和工作副本。要将新获取的更改放入您的分支,请使用git svn rebase
; 它将在最新的 svn 修订版之上重新应用所有本地更改。
git svn rebase
will do a fast-forward when there are no local commits, so it should not mess with history. Alternatively you could use git merge --ff-only git-svn
to fast-forward to the most recent svn revision (and abort when it is not fast-forwardable, i.e. not a direct descendant)
git svn rebase
当没有本地提交时会进行快进,所以它不应该与历史混淆。或者,您可以使用git merge --ff-only git-svn
快进到最新的 svn 修订版(并在它不可快进时中止,即不是直接后代)
You should only use git svn reset
when upstream svn has changed history (svndump/svnadmin) and you need to re-fetch the new commits, but this should almost never happen (otherwise blame the admin!)
您应该只git svn reset
在上游 svn 更改历史记录(svndump/svnadmin)并且您需要重新获取新提交时使用,但这几乎永远不会发生(否则责怪管理员!)
回答by Matthew Flaschen
I believe you want git svn rebase
. This is different from git pull
, but similar in that both involve two steps (fetch from remote and then rebase or merge).
我相信你想要git svn rebase
。这与 不同git pull
,但相似之处在于都涉及两个步骤(从远程获取,然后变基或合并)。
You can also rebase only already fetched commits:
您还可以仅对已获取的提交进行变基:
git svn rebase --local
If you have local commits that are not yet in SVN, git-svn will replay (rebase) them on top of the newest SVN commits.
如果您有尚未在 SVN 中的本地提交,git-svn 将在最新的 SVN 提交之上重放(rebase)它们。
回答by Andry
Has the same issue here in 2018 with the latest git. Resolved by removing the .rev_map
and index
files and rerun git svn fetch
.
2018 年最新的 git 也有同样的问题。通过删除.rev_map
和index
文件并重新运行来解决git svn fetch
。
/.git/svn/refs/remotes/origin/trunk/.rev_map.<GUID>
/.git/svn/refs/remotes/origin/trunk/index
Somehow it has been stuck on incorrect last svn revision association in the cache. In mine case it was the r32 revision which actually was the r31 revision (because r32 and r31 has clearly different commit messages, this is how i detected that) and it has been showing r32 revision with the commit message from the r31 revision.
不知何故,它一直卡在缓存中不正确的最后一个 svn 修订关联上。在我的情况下,它是 r32 修订版,实际上是 r31 修订版(因为 r32 和 r31 具有明显不同的提交消息,这就是我检测到的)并且它一直显示 r32 修订版和来自 r31 修订版的提交消息。
Caution:
警告:
Has catched another problem. The git pull origin trunk:master
in mine case has reverting changes back before the reindex. So DO NOT DO the pulling. Make the rebase
and push
before the pull
to propogate the fixed changes to the remote repository.
又发现了一个问题。将git pull origin trunk:master
在我的案件还原更改重新索引前备份。所以不要拉。制作rebase
和push
之前 将pull
固定更改传播到远程存储库。