[英]When git svn dcommit can be used?
I want to learn how to use git with svn repository. 我想学习如何在svn仓库中使用git。
I follow this manual: http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion 我遵循此手册: http : //git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion
I make some changes in my file. 我对文件进行了一些更改。 Some of them staged, some of them not:
其中一些上演,有些则没有:
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: CHANGES.txt
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: CHANGES.txt
#
According to the manual I first commit staged changes into my local repository: 根据手册,我首先将更改阶段化到我的本地存储库中:
$ git commit -m "new"
[master 21bf2bd] new
1 file changed, 1 insertion(+)
now I have only unstages changes, which I want to live like it is for the future commits: 现在,我只有阶段性的变更,我想像将来的提交那样生活下去:
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: CHANGES.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
And I want to push local commits upstream to svn: 我想将本地提交推向svn:
$ git svn dcommit
CHANGES.txt: needs update
update-index --refresh: command returned error: 1
Why can't I do it? 我为什么不能这样做?
When can I use "dcommit" and when I can't? 什么时候可以使用“ dcommit”,什么时候不能使用? I clearly lack this information, and I wasn't able to find more description in google or man pages .
我显然缺少此信息,因此无法在google或手册页中找到更多描述。
You can't have any non-commited changes when you do dcommit. dcommit时,您不能有任何未提交的更改。
To temporarily hide your modifications, use git stash
. 要临时隐藏您的修改,请使用
git stash
。 Then commit with git svn dcommit
, and finally pop the stash with git stash pop
to enable your modifications once again. 然后使用
git svn dcommit
提交,最后使用git stash pop
存储,以再次启用您的修改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.