Iaka Noe
Iaka Noe

Reputation: 43

Not dcommitting every change made to svn using git-svn

I have an SVN repo that I have copied in my PC and I've been making some changes and commits. I make a commit for every code issue I solve (that I've been asked to solve). If I'm in the process of solving one, I just save the code and leave it on my computer (until I solve it, that I commit it). I'm using git svn.

Today I've solved three issues (and so made three commits) and I left the code in the process of solving another one. I want to push (dcommit) all commits I've made locally.

The thing is: I still have files that have not been committed and, when I try to dcommit I get "needs update" for every one of them.

How can I git svn dcommit only what I have done git add to in my local repo? I want to do just what git push does, and have all my unversioned files/diffs untouched.

I know this is probably malpractice or something, but there goes my workflow.

Upvotes: 0

Views: 34

Answers (1)

eftshift0
eftshift0

Reputation: 30212

First of all, I think you need to run git svn fetch in order to be able to see what other developers have been doing on the svn branch you are trying to push onto. Then, in order to be able to do actual work to push your changes and stuff, you will have to stop what you are doing and clean up the working tree. In order to do that run git stash save. Then you should be able to move around at ease. Now, you should rebase on top of the updated tip of the svn branch and now you should be able to run git svn dcommit to push into svn. Then you might consider getting what you had stashed poped out so you can continue working git stash pop.

Edit:

Since git 2.16 git stash save is deprecated in favour of git stash push. It differs from "stash push" in that it cannot take pathspecs, and any non-option arguments form the message.

Upvotes: 2

Related Questions