tags:

views:

105

answers:

3

So I'm using git-svn to keep in sync with our main svn repo. I also have created a remote git repo to push branches for safekeeping off of my machine until the changes are ready to be merged into svn. The problem is when I have a commit that needs to go to both svn and git, I have to git svn dcommit first. dcommit rewrites the SHAs of commits. If I've pushed, git then views the commit, rightly, as two commits as they have differing SHAs but the same content. Sometimes, I forget to svn dcommit first. How can I deal with this if I do? I need to remove the commit from the remote branch without removing it from the local repo. What I've been doing is whacking the git repo since at the moment, I'm the only one using it, but this is clearly not a satisfactory solution.

EDIT: I forgot to mention that the remote git repo is bare.

+1  A: 

You could try fetching into the Git remote, instead of pushing to it. In other words instead of doing git push remote from the local machine (where your working copy is located), log-in to the remote machine and do git fetch local. This will always succeed. If you accidentally fetch to the remote before you do git svn dcommit, it's no problem. Just do the dcommit and then re-fetch. The fetch will always force-update any branches that need it.

Dan Moulding
+1  A: 
  1. Add pre-receive-check hook in git repo next time to avoid none dcommited information to git repo on master branch
  2. clean the git repo, and push it again. or revert to the sync stage and push again
larrycai
A: 

You may find the workflow that I describe in this article to be helpful. In particular, I believe you can utilize the same procedure described in step 3 to "back out" the commits in the remote git repo and then git push the git-svn-id-tagged commits. Your caveat about traffic on the remote git repo is of course an important one.

I do use this procedure with a bare remote git repo.

jstevenco