I would like to use Git for my own purpose and I must use Subversion repository in my company. I know that there is 'git svn' command but it requires lineral history also in git repository. The problem with that is that I would like: - to synchronize git repository with another my git repository on my remote disk so that I can synchronize it with another git repository on different computer, - and the most important: I would like to commit frequently in my git repository and when I decide that this small steps are worth to commit (big enough to share) I would like to commit them to svn but with only one commit... So I wouldn't like to show all my git (mayby sometimes stupid, too small commits just to remember something) in svn, - and with 'git svn' I cannot use branches (because when I merge them with master, master will not have lineral history).
Please help... Maybe there is some workflow in which I can use git in it's full glory and svn to commit bigger (not my 'private'... maybe very small changes and which for some time casue that cod doesn't compile) changes to my company repository.
Thanks in advance!
git svn is a git command that allows using git to interact with Subversion repositories. git svn is part of git, meaning that is NOT a plugin but actually bundled with your git installation. SourceTree also happens to support this command so you can use it with your usual workflow.
While SVN is no longer the most used VCS, it has managed to establish itself in a few very niche areas. Features like customizable access control to project files and a central server are some reasons why developers may still be using SVN.
The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.
SVN is better than Git for architecture performance, binary files, and usability. And it may be better for access control and auditability, based on your needs.
I would like to synchronize git repository with another my git repository on my remote disk so that I can synchronize it with another git repository on different computer.
Try:
git remote add external-repo ssh://host/path/to/git/repo.git
git push origin external-repo
I would like to commit frequently in my git repository and when I decide that this small steps are worth to commit (big enough to share) I would like to commit them to svn but with only one commit.
No sweat. Collapse multiple commits with git rebase -i
(this is called "squashing") and decide whether you want to keep, throw away, or squash each commit into a larger one. It's very helpful for getting organized before pushing to an external repo. The -i
is for "interactive" mode.
with 'git svn' I cannot use branches (because when I merge them with master, master will not have lineral history).
That's not true. Just set up a branch on git
for each branch you want to track with svn
. In the opposite direction, you're only pushing one branch at a time anyway.
I work this way all the time at my company (really just can't stand subversion anymore). What makes you think you can't use branches with git svn? Not only can you use them, you can commit from them directly back to subversion.
To do the merging of commits you'd use something like git rebase remotes/trunk --interactive
and squash commits together. However you can't maintain both your expanded version and your condensed versions at the same time. You either get all the little tiny commits or you get the squashed ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With