简体   繁体   中英

git svn dcommit one file

I have a git checkout of an svn repository created via git svn clone. I have a complicated series of changes to my local git repository, which I am delaying pushing to the central svn repo. I would like to push a small change to one file. When using the svn client I would do

svn commit foobar.c

Is there a way to get similar functionality with git?

Easy.

Solution one: Anything uncommited inside git can be stashed away. 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. Commit the file to the master branch inside git. DCommit to SVN. Rebase the created new branch onto the new master after 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. 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. 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 . Then you are back to a linear history with your later commit in between and continue working on your new features.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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