Hi,
I came across a document about migrating from SVN to GIT. Can anyone tell me what is the difference between SVN and GIT, and which of these two is better.
Thanks in advance.
Difference between svn and git
2 posts
• Page 1 of 1
Re: Difference between svn and git
Hi,
GIT is distributed, SVN is not:
This is by far the *core* difference between GIT and other non-distributed version control systems like SVN, CVS etc. If you can catch this concept well, then you have crossed half the bridge. To add a disclaimer, GIT is not the first or only distributed VCS(version control system) currently available. There are other tools like Bitkeeper, Mercurial etc. which also work on distributed mode. But, GIT does it better and comes with much more powerful features.
GIT like SVN do have centralized repository or server. But, GIT is more intended to be used in distributed mode which means, every developers checking out code from central repository/server will have their own cloned repository installed on their machine. Let’s say if you are stuck somewhere where you don’t have network connectivity, like inside the flight, basement, elevator etc. , you will still be able to commit files, look at revision history, create branches etc. This may sound trivial for lot of people but, it is a big deal when you often bump into no-network scenario.
And also, the distributed mode of operation is a biggest blessing for open-source software development community. Instead of creating patches & sending it thro emails, you can create a branch & send a pull request to the project team. It will help the code stay streamlined without getting lost in transport. GitHub.com is an awesome working example of that.
There were some rumors that the future version of subversion will be working on distributed mode. But, it’s still an unknown at this point.
GIT stores content as metadata, SVN stores just files:
Every source control systems stores the metadata of files in hidden folders like .svn, .cvs etc., whereas GIT stores entire content inside the .git folder. If you compare the size of .git folder with .svn, you will notice a big difference. So, the .git folder is the cloned repository in your machine, it has everything that the central repository has like tags, branches, version histories etc.
GIT branches are not the same as SVN branches:
Branches in SVN are nothing but just another folder in the repository. If you need to know if you had merged a branch, you need to explicitly run commands like svn propget svn:mergeinfo to verify if it was merged or not. Thanks Ben for pointing this feature .
So, the chance of adding up orphan branches is pretty big.
Whereas, working with GIT branches is much more easier & fun. You can quickly switch between branches from the same working directory. It helps finding un-merged branches and also help merging files fairly easily & quickly.
GIT does not have a global revision no. like SVN do:
This is one of the biggest feature I miss in GIT from SVN so far. As you may know already SVN’s revision no. is a snapshot of source code at any given time. I consider that as a biggest breakthrough moving from CVS to SVN.
Since, GIT & SVN are conceptually different, I don’t know how you can mirror that feature in GIT. If anyone know of any tricks that can do this, please feel free to share it in the comments.
Update: As some of the readers pointed out, you can use GIT’s SHA-1 hash key to uniquely identify the code snapshot. It may not exactly replace SVN’s easily readable numeric revision no. but, it kind of serves the same purpose.
GIT’s content integrity is better than SVN’s:
GIT contents are cryptographically hashed using SHA-1 hash algorithm. This will ensure the robustness of code contents by making it less prone to repository corruption due to disk failures, network issues etc. Here is an interesting discussion on GIT’s content integrity – http://stackoverflow.com/questions/9643 ... -integrity
GIT is distributed, SVN is not:
This is by far the *core* difference between GIT and other non-distributed version control systems like SVN, CVS etc. If you can catch this concept well, then you have crossed half the bridge. To add a disclaimer, GIT is not the first or only distributed VCS(version control system) currently available. There are other tools like Bitkeeper, Mercurial etc. which also work on distributed mode. But, GIT does it better and comes with much more powerful features.
GIT like SVN do have centralized repository or server. But, GIT is more intended to be used in distributed mode which means, every developers checking out code from central repository/server will have their own cloned repository installed on their machine. Let’s say if you are stuck somewhere where you don’t have network connectivity, like inside the flight, basement, elevator etc. , you will still be able to commit files, look at revision history, create branches etc. This may sound trivial for lot of people but, it is a big deal when you often bump into no-network scenario.
And also, the distributed mode of operation is a biggest blessing for open-source software development community. Instead of creating patches & sending it thro emails, you can create a branch & send a pull request to the project team. It will help the code stay streamlined without getting lost in transport. GitHub.com is an awesome working example of that.
There were some rumors that the future version of subversion will be working on distributed mode. But, it’s still an unknown at this point.
GIT stores content as metadata, SVN stores just files:
Every source control systems stores the metadata of files in hidden folders like .svn, .cvs etc., whereas GIT stores entire content inside the .git folder. If you compare the size of .git folder with .svn, you will notice a big difference. So, the .git folder is the cloned repository in your machine, it has everything that the central repository has like tags, branches, version histories etc.
GIT branches are not the same as SVN branches:
Branches in SVN are nothing but just another folder in the repository. If you need to know if you had merged a branch, you need to explicitly run commands like svn propget svn:mergeinfo to verify if it was merged or not. Thanks Ben for pointing this feature .
So, the chance of adding up orphan branches is pretty big.
Whereas, working with GIT branches is much more easier & fun. You can quickly switch between branches from the same working directory. It helps finding un-merged branches and also help merging files fairly easily & quickly.
GIT does not have a global revision no. like SVN do:
This is one of the biggest feature I miss in GIT from SVN so far. As you may know already SVN’s revision no. is a snapshot of source code at any given time. I consider that as a biggest breakthrough moving from CVS to SVN.
Since, GIT & SVN are conceptually different, I don’t know how you can mirror that feature in GIT. If anyone know of any tricks that can do this, please feel free to share it in the comments.
Update: As some of the readers pointed out, you can use GIT’s SHA-1 hash key to uniquely identify the code snapshot. It may not exactly replace SVN’s easily readable numeric revision no. but, it kind of serves the same purpose.
GIT’s content integrity is better than SVN’s:
GIT contents are cryptographically hashed using SHA-1 hash algorithm. This will ensure the robustness of code contents by making it less prone to repository corruption due to disk failures, network issues etc. Here is an interesting discussion on GIT’s content integrity – http://stackoverflow.com/questions/9643 ... -integrity
- dani_kurian
- Posts: 0
- Joined: Mon Feb 23, 2015 10:02 am
2 posts
• Page 1 of 1