Mirroring a git subdirectory in a SVN subdirectory -
yes, know there ton of version control questions on here, none of proposed solutions want them , can't find way hack 1 together. i've been looking week now.
my setup:
windows 7 machine (with cygwin-- though haven't touched problem), remote password-protected git repo , svn repo. gradually switching using svn git new projects (no 1 has used git before) , need shuffle code , forth.
what want:
i , several other people should able work in gitproject/path/to/sharedcode
, have our commits automatically update svnproject/trunk/path/to/sharedcode
. should affect 2 subdirectories, rest of repos should remain independent. i'm looking one-way, permanent link git subversion. history needs preserved in git, not in svn, no development take place there. additionally, repeatable in future can set anothersvnproject/trunk/path/to/sharedcode
mirror in same way.
possible solutions:
- a script checks changes in
gitproject/path/to/sharedcode
(runsgit diff
) and, if finds any, copies them , pushes them svn repo. run automatically every day or called dev made changes. - a script ^this^ run when making commits instead of running
git push gitproject master
pushes changes both git , svn.
or, if else fails,
- a clear, obvious workflow of can follow when working in git. "first, checkout gitproject command. create new branch named name command. make changes. go location , run command..."
what i've tried:
subgit looks overkill our purposes, , don't want to/don't have authority set since it's not open-source. without creating new repo, well.
using git-svn create new repo in
gitproject/path/to/sharedcode
git svn init --trunk=http://svnhost.com/svnproject/trunk/path/to/sharedcode --no-minimize-url
. creates new local repo can push from, may useful batch script, it's not ideal solution.git2svn looks promising, can't find documentation it, don't trust it.
i've used svn2git (the 1 written in ruby) before , worked beautifully, don't think has functionality need now.
git-subversion bridge looks similar want automatic synchronization, again, it's complicated , involves setting whole new repo. if rest of team we'll end using this.
i tried writing windows batch script described. went like:
git pull
latest version of gitproject, rungit diff
ongitproject/sharedcode
,svnproject/sharedcode
, pipe output txt file, use awful, awful windowsif
statement ifdiff
picked besides readme,robocopy /mir
contents ofgitproject/sharedcode
svnproject/sharedcode
,robocopy
correct readme backupsvnproject/sharedcode
,svn add
everything,svn checkout
remote repo, ,svn commit
. didn't work.
i'm sure have pieces of solution, lack knowledge , coding skills bring them together. i'm hoping stackoverflow can help.
- you can't operate on part of tree inside git repo (in short words - it's monolithic object, contrary svn)
- due p.1, must split git repository , convert
/path/to/sharedcode
additional special repository. can use submodules or subtree approach (trendy git-boys prefer today subtree) - with dedicated repo you, using git-svn, can add new remote
svnproject/trunk/path/to/sharedcode
(git-history mirrored svn, it's laziest , easiest way)
Comments
Post a Comment