Alexander Solovets Alexander Solovets - 13 days ago 8
Git Question

git-svn always generates unique hashes

I'm working on a project for a long time was hosted in SVN repository, and now is in the process of transitioning to GitHub.

Currently I'm the only developer who works primarily in Git, others work with SVN. My workflow is as simple as: gitsvn clone , git commit , git-svn dcommit, git push . But if someone else also worked in Git, we would get conflicts when pushing to GitHub, because `git svn clone' generates unique hashes each time you run it, so for two distinct clones histories are completely different.

Is it possible to force git-svn to generate equal hashes for same SVN revisions? Or is there any other workflow scheme allowing to work on the same code base in Git and SVN simultaneously?

Answer

Is it possible to force git-svn to generate equal hashes for same SVN revisions?

Yes, it is. You don't even have to force it. Seriously: If you git svn clone the same SVN repository multiple times with the same parameters, you get equal hashes (I just tested it).

If you are getting different hashes, the parameters during the clone must be different (path parameters, SVN repo URL...) - or maybe you are using different versions of git-svn.

My workflow is as simple as: gitsvn clone , git commit , git-svn dcommit, git push [...] Or is there any other workflow scheme allowing to work on the same code base in Git and SVN simultaneously?

"git-svn dcommit, git push": That is your problem.

Normally using Git and SVN concurrently should work out-of-the-box. One caveat: You should not directly push/pull between different git svn clones. So your use of git push is probably causing the trouble. As the manpage explains (highlighting mine):

For the sake of simplicity and interoperating with Subversion, it is recommended that all git svn users clone, fetch and dcommit directly from the SVN server, and avoid all git clone/pull/merge/push operations between git repositories and branches. The recommended method of exchanging code between git branches and users is git format-patch and git am, or just 'dcommit’ing to the SVN repository.

If you follow that advice, you should be fine.

Comments