Co-Existence Subversion & Git: Difference between revisions
Line 13: | Line 13: | ||
The first very basic question is can you have 2 VCS systems next to each other? | The first very basic question is can you have 2 VCS systems next to each other? | ||
<br>The common answer is ''Yes'', the more advanced answer is ''Maybe'', and the smart answer is ... | <br>The common answer is ''Yes'', the more advanced answer is ''Maybe'', and the smart answer is ... | ||
=== Important remark === | |||
One of the possible solutions is using ''git svn''. That solution is not mentioned, because I want to have a complete separated Git from Subversion. | |||
=== Git vs SVN adaption === | === Git vs SVN adaption === | ||
Line 20: | Line 23: | ||
* The Subversion-workflow is easy, embedded and well understood | * The Subversion-workflow is easy, embedded and well understood | ||
* The adaption of Git is difficult due to the its steep learning curve. | * The adaption of Git is difficult due to the its steep learning curve. | ||
== Migration and coexistence == | == Migration and coexistence == |
Revision as of 10:45, 3 February 2019
You are definitely not alone when you have a wide range of Subversion repositories, but want to move to Git.
Or you have a lot of users who want to use SVN, but also a lot of users wanna use Git instead.
Introduction
There are even more reasons to have more than one VCS:
- Migration, Git is more sophisticated than Svn and more reliable (more than one point of restore against one point of disaster).
- Co-existence, preparing the migration mau need both systems to work next to each other.
- Proof of Concept, before deciding to migrate you want to know if the solution works for you.
- Mixed, one or more of the above mentioned items.
Git is powerful, but has also a steep learning curve, making the implementation difficult.
The first very basic question is can you have 2 VCS systems next to each other?
The common answer is Yes, the more advanced answer is Maybe, and the smart answer is ...
Important remark
One of the possible solutions is using git svn. That solution is not mentioned, because I want to have a complete separated Git from Subversion.
Git vs SVN adaption
Of coarse the normally answer should be stick to just one VCS, but that is beyond the main question, in the end you want to have only one VCS, but:
- Many scripts are working with SVN
- Migration of all scripts may not be possible or not wanted at the moment.
- The Subversion-workflow is easy, embedded and well understood
- The adaption of Git is difficult due to the its steep learning curve.
Migration and coexistence
Migration can not be done without a intermediate state, meaning there will always be a period of coexistence of both the old and the new state.
Big bang migration is possible. The problem of coexistence is then minimized in the development phase.
But with a new workflow for the development the problem is not the coexistence but the adaption.
So in the end, you always have coexistence. Better accept that coexistence is part of the migration!
Knowing me, knowing you
No, not at all. Both systems should not know anything about each other, so:
Subject | Subversion | Git |
---|---|---|
Repository | Repository is stored into the directories .svn | Local repo is stored into the directory .git |
Ignores | The embedded svnignore contains
|
File .gitignore contains
|
But things can be complicated. Most developers using tools to do the job, in the dev-tool/editor as add-on, standalone as separate tool or a command-line client. Examples:
Tools | Subversion | Git |
---|---|---|
CLI | svn | git |
Standalone | Cornerstone | Sourcetree |
Add-on | Sublime-Text, Eclipse | Sublime-Text, Eclipse |
Add Git to Subversion
The first scenario is to add Git to an existing Subversion repository.
- Assuming the remote repository will be stored into GitLab [1]
- Assuming the User of Gitlab is named 'HaFr1954'
- Assuming the subversion project is named 'AWK'
- Assuming the subversion project is located in '/Sources/AWK'.
The steps are:
- Goto the Website of GitLab and Login with the UID 'HaFr1954' (Replace the name by your name)
- Create a new blank project
- Project Name: 'AWK'
- Project URL: https://gitlab.com/HaFr1954
- Project slug: awk
- Project description: <Make your own description>
Problems
- Weird Differences. After Git Commit & Push and the usage of Subversion Commit, some local checkouts have differences (git status).
- Commit Sequence. Does the sequence of commit causing anomalies? It is not expected, but it can occur.
Weird Differences
After Git Commit & Push and the usage of Subversion Commit, some local checkouts have differences (git status) [2].
First try to find the difference:
$ git status On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: myfile # This difference does not show and difference $ git diff master origin/master # This might show a difference $ git show HEAD:myfile|md5 $ md5 myfile # To get rid of this problem do: # 1. Removing the files from the index $ git rm --cached -r . rm '.gitignore' ... # 2. Reset the indexes $ git reset --hard
Commit Sequence
I have to admit, I always start with the Git Commit and Push before doing the Subversion commit. And I am getting anomalies.
The main problem is that why is not that easy to pinpoint.
There are several reasons:
- To Git-Commit & Push I am using Sourcetree, Git-CLI and a home-made-Bash-Script.
- To Svn-Commit & Push I am using Cornerstone, Svn-CLI and a home-made-Bash-Script.
- The Bash scripts are scheduled and run twice a day.
Things are getting complicated just by the statistical number of possible different occurrences (servers maybe down so there is no way to be sure which VCS action is taken first).
See also
- Implements Blog, Using Git and Subversion together.
- Net Instructions, Git and Subversion together.
- Git-SCM, Git and Other Systems - Git and Subversion.
Reference
- ↑ GitLab, since Github is owned by Microsoft GitLab is the place to be.
- ↑ Stack Overflow, Git status shows files as changed even though contents are the same.