git svn dcommit 总是失败,并显示“无法使用脏索引进行 dcommit”。
$ git --version
git version 1.7.0.3
我克隆了一个 SVN 存储库,并进行提交:
$ git svn clone --stdlayout http://svn/example/project
$ echo test >> blah.txt
$ git commit -m "Something"
当我尝试dcommit
回到 SVN 时,我收到以下错误:
$ git svn dcommit
Cannot dcommit with a dirty index. Commit your changes first, or stash them with `git stash'.
at .../git/1.7.0.3/.../libexec/git-core/git-svn line 497
..尽管分支看起来很干净:
$ git status
# On branch master
nothing to commit (working directory clean)
我能看到的唯一地方gitk 中不存在“未暂存的更改”,其中显示“本地未提交的更改,未签入索引”
运行 git stash 允许 dcommit code> 由于某种原因工作:
$ git stash
No local changes to save
$ git svn dcommit
Committing to http://svn/example/project ...
M blah.txt
Committed r65913
M blah.txt
r65913 = a5547d761108d233211f115429e23ddca73bf4bc (refs/remotes/trunk)
No changes between current HEAD and refs/remotes/trunk
Resetting to the latest refs/remotes/trunk
我有一个别名来运行 git stash; git svn dcommit; git stash apply - 但这不是最好的解决方法,因为它在实际使用存储时会导致合并错误
$ git --version
git version 1.7.0.3
I clone an SVN repository, and make a commit:
$ git svn clone --stdlayout http://svn/example/project
$ echo test >> blah.txt
$ git commit -m "Something"
When I try and dcommit
back to the SVN, I get the following error:
$ git svn dcommit
Cannot dcommit with a dirty index. Commit your changes first, or stash them with `git stash'.
at .../git/1.7.0.3/.../libexec/git-core/git-svn line 497
..despite the branch being seemingly clean:
$ git status
# On branch master
nothing to commit (working directory clean)
The only place I can see the non-existent "unstaged changes" is in gitk
, where it says "Local uncommitted changes, not checked in to index"
Running git stash
allows the dcommit
to work for some reason:
$ git stash
No local changes to save
$ git svn dcommit
Committing to http://svn/example/project ...
M blah.txt
Committed r65913
M blah.txt
r65913 = a5547d761108d233211f115429e23ddca73bf4bc (refs/remotes/trunk)
No changes between current HEAD and refs/remotes/trunk
Resetting to the latest refs/remotes/trunk
I have an alias to run git stash; git svn dcommit; git stash apply
- but this is not the best workaround, as it causes merge errors when using actually using the stash
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我写问题时,我发现了以下提交:
http://repo .or.cz/w/git.git/commitdiff/181264ad590ffef9d956fdd023369869c2d0a55f
无法从 git 日志中破译更改所在的版本,但看起来更改应该在
1.7.2.2
编辑: 之后的版本中截至 2011 年 11 月 19 日,提交仍然仅在 master 分支中:
Edit2: 此更改现在在 git 1.7.3 中
As I was writing the question, I found the following commit:
http://repo.or.cz/w/git.git/commitdiff/181264ad590ffef9d956fdd023369869c2d0a55f
Can't decipher from the git log what version the change is in, but it looks like the change should be in the version after
1.7.2.2
Edit: As of Nov 19, 2011, the commit is still only in the master branch:
Edit2: This change is now in git 1.7.3 onwards
当我尝试执行 git svn dcommit 时,我收到了类似的错误。
我尝试从非根 git 文件夹(其中包含 .git-subfolder)提交,并在 SVN 存储库中进行更改,但我尚未通过 git svn rebase 检索到 git 。
I received similar error when I tried to execute
git svn dcommit
.I tried to commit from non-root git folder (which contains
.git
-subfolder) and with changes in SVN repo which I have not retrieved yet to git viagit svn rebase
.