作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
$ git --version
git version 1.7.0.3
$ 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
,它说“本地未提交的更改,未 checkin 索引”
git stash
允许
dcommit
出于某种原因工作:
$ 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
- 但这不是最好的解决方法,因为在实际使用存储时会导致 merge 错误
最佳答案
在我写这个问题时,我发现了以下提交:
http://repo.or.cz/w/git.git/commitdiff/181264ad590ffef9d956fdd023369869c2d0a55f
The dcommit command fails if an otherwise unmodified file has been touched in the working directory:
Cannot dcommit with a dirty index. Commit your changes
first, or stash them with `git stash'.This happens because "git diff-index" reports a difference between the index and the filesystem:
:100644 100644 d00491...... 000000...... M file
The fix is to run "git update-index --refresh" before "git diff-index" as is done in git-rebase and git-rebase--interactive before "git diff-files".
This changes dcommit to display a list of modified files before exiting.
Also add a similar test case for "git svn rebase".
1.7.2.2
之后的版本中
$ git branch --contains 181264ad590ffef9d956fdd023369869c2d0a55f
* master
> git tag --contains 181264ad590ffef9d956fdd023369869c2d0a55f | sort -V
v1.7.3
[...]
关于git svn dcommit 总是以 "Cannot dcommit with a dirty index."失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3572074/
我是一名优秀的程序员,十分优秀!