SVN / Git / Bash

I am working on a project with a team. They use SVN, but I prefer git. Although I could make it easier by simply improving in SVN - I would rather complicate my life and use git.

Here are their settings:

~/www(svn) | \ trunk(svn) mybranch(svn) 

I would like to have

 /srv/git/www 

with branches and mybranch

when I do git pulling inside /srv/git/www and in the trunk branch I just like it if the script updates svn to ~/www/trunk and updates the git branch with any svn transactions (so that the git history and commit messages correspond to the messages svn and commit)

it will do the same behavior on git pull on git mybranch branch

Then my workflow will be

 git checkout trunk git pull git checkout mybranch git rebase trunk 

do some work

(if the connecting line was not updated, as I pulled it):

 git commit git push git checkout trunk git merge mybranch git push 

I would really like it if the git hook would then run svn commit whenever the code fits into any of these branches.

Please offer any recommendations. At first I tried using SVN, but I'm so upset that I blocked it, and I had to relearn every time the merge goes badly, which really annoys me SVN.

If anyone has a better model for this, please tell me. Otherwise, it would be outstanding if you could tell me how to do it with git! I know there is a git svn command, but I don’t believe it - I was hoping that the above is safer (although it seems a little crazy to me).

Thanks!

+4
source share
2 answers

You described how SubGit works. Starting with 2.0, it allows for bi-directional translation between Git and SVN using the pre-receive Git hook (which runs on 'git push'). To run this run on your computer

 $ subgit configure --svn-url <URL_of_repository_root> repo.git $ #adjust repo.git/subgit/{config,passwd,authors.txt} to set auth options, branches to translate and SVN<->Git authors mapping $ subgit install repo.git 

Then clone repo.git (even if it just does the "pre-receive" job on the same machine)

 $ git clone repo.git myproject $ cd myproject $ #do something with master $ git push origin master 

Each new achievement accessible from "master" will be translated into a commit in SVN. By default, the same is true for other branches.

+3
source

At first I tried using SVN - but I'm so upset that I blocked it, and I had to relearn every time the merge goes badly, which really annoys me SVN.

I really have not noticed that Subversion has the problems you have. I don’t feel it is blocking and merging with Subversion works very well. In fact, I have fewer Subversion merge issues than Git merge. I suspect that most of your frustration is with unfamiliar software, and not with inherent problems with Subversion. I am also upset about software that does not work the way I use.

However, you can also use Subversion instead of getting around the problem. You will be working for Subversion again and again because it is popular in the software world. It is easy to use and works well. In this world, you may prefer OS X and Linux on Windows, but you still need to know Windows. I know that unfamiliar software also upsets me. However, unlike Windows, Subversion is not evil. In addition, it works very well.

One thing I like about Git that I really miss Subversion is the ability to do my work without affecting the main repository. My workflow in Git is as follows:

 git checkout git pull git add git commit git add git commit git add git commit git add git commit git add git commit git add git commit git push 

If you are a serial committer like me, you can try Git-SVN : This allows you to work with Git locally and execute sequential commits, but when you do pushes and pulls, you are really talking to the Subversion repository. However, this does not mean that you can simply pretend that you only work with Git. When I enter and unite, I still need to talk directly to Subversion.

Unless you're a serial committer, Git-SVN probably won't buy you much. All you do is complexity and more frustrations.

Subversion is designed to work with an unstable trunk model, which is used in a continuous integration environment. This means that everyone usually has the same branch. It makes you play well with others and make small incremental changes. However, there is no reason why you cannot create your own branch in Subversion and do your work there.

I am doing a lot of code restructuring, which means that you move files and do a lot of work that cannot be completed in one day. I can’t work in the same branch that all other developers use, so I create my own private branch. If someone should have problems with the merge, it will be me, because I do not just modify the file here or there, I change the entire layout of the code. However, Subversion almost always handles merging with aplomb. I regularly reinstall. When I finish my work, I will make mass delivery without any problems. Then I will delete my branch.

+3
source

All Articles