简体   繁体   English

git svn dcommit一个文件

[英]git svn dcommit one file

I have a git checkout of an svn repository created via git svn clone. 我有一个通过git svn clone创建的svn存储库的git checkout。 I have a complicated series of changes to my local git repository, which I am delaying pushing to the central svn repo. 我对我的本地git存储库进行了一系列复杂的更改,我推迟到中央的svn repo。 I would like to push a small change to one file. 我想将一个小的更改推送到一个文件。 When using the svn client I would do 当我使用svn客户端时,我会这样做

svn commit foobar.c

Is there a way to get similar functionality with git? 有没有办法获得与git类似的功能?

Easy. 简单。

Solution one: Anything uncommited inside git can be stashed away. 解决方案一:git内部任何未解决的问题都可能被隐藏起来。 No uncommitted files are allowed when dcommitting anyways. 无论如何都不允许任何未提交的文件。

Solution two: Start a new branch where you are now. 解决方案二:开始你现在的新分支。 Reset the master branch to the last commit you git from SVN. 将master分支重置为您从SVN git的最后一次提交。 Commit the file to the master branch inside git. 将文件提交到git中的master分支。 DCommit to SVN. DCommit到SVN。 Rebase the created new branch onto the new master after dcommit. 在dcommit之后将创建的新分支重新引导到新主分支上。

Any questions? 任何问题? Using a graphical tool will greatly help here... 使用图形工具将极大地帮助...

As long as you didn't dcommit anything, you are totally able to use anything Git has to offer, including branching and rebasing things. 只要你没有提交任何内容,你就完全可以使用Git提供的任何东西,包括分支和变基础。 So what you probably want to do is create a branch off the current SVN version ( git branch <name> remotes/trunk ) and work on that for now. 所以你可能想要做的就是从当前的SVN版本( git branch <name> remotes/trunk )创建一个分支,并立即处理它。 Then you can dcommit those changes as you are used to. 然后,您可以按照惯例拒绝这些更改。

To continue with your other changes then, you could rebase them to match the commits you pushed in between using git rebase remotes/trunk . 要继续进行其他更改,您可以将它们重新绑定以匹配使用git rebase remotes/trunk之间推送的提交。 Then you are back to a linear history with your later commit in between and continue working on your new features. 然后,您将回到线性历史记录,稍后提交,并继续处理新功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM