POKE ME for any consultancy

Monday, March 21, 2016

GIT Vs SVN

a) GIT is a distributed version control system while SVN is a centralized version control system.
With Git, each user has a complete copy of the repository data stored locally. Hence, making access to file history extremely fast, as well as allowing full functionality event when disconnected from the network. It also means every user has a complete backup of the repository. Hence, If any user repository is lost due to system failure, then only the changes which were unique to that repository are lost. If users frequently push and fetch changes with each other, then this tends to be a small amount of loss.
With SVN, only the central repository has the complete history. This means that users must communicate over the network with the central repository to obtain history about a file. Backups must be maintained independently by normal copy/paste of the source code. If the central repository is lost due to system failure it must be restored from backup and changes since that last backup are likely to be lost.
- Git repo is created locally on your machine, not a central hub and spoke model like SVN
- Since the repository is local, it’s faster than network based operations
- Easier to work offline
- History and revert is faster and can be done offline
- Each working copy is a branch
- Merges are tracked more closely, happens more frequently

b) Git is extremely fast as compared to SVN because all operations (except for push and pull/fetch) are local. There is no network latency involved for doing following tasks:
1) Perform a diff.
2) View file history.
3) Commit changes.
4) Merge branches.
5) Obtain any other revision of a file.
6) Switch branches.
c) GIT repository and working directory sizes are extremely small as compared to SVN. An SVN working directory always contains two copies of each file, one for the user for work and another hidden in .svn/ to support operations such as status, diff and commit. While a GIT working directory(.git/) requires only one small index file that stores about 100 bytes of data per file.
d) GIT does not have a global revision no. like SVN do.
SVN assigns revision numbers sequentially (starting from 1). Since the revision number is global to the entire repository(including all branches) with SVN, there is still a question of which branch the revision number corresponds to. The last committed revision makes it possible to determine which branch was used.
GIT uses a SHA1(40 character hexadecimal string) to uniquely identify a commit each specific revision. This string identifies the revision as well as the branch it came from.
e) SVN’s revision numbers(starting from 1) are predictable while GIT’s not. Hence, you can easily perform actions related to revisions easily. But with GIT, similar actions requires looking at the log.
f) With SVN, you can check out just a sub-directory of a repository. This is not possible with Git.
- Git is primarily command line, not many visual tools exist (yet) for Git
- SVN’s single repository makes it easier to know you have everything
- SVN having one central repo makes it easier to backup
- The distributed nature of Git makes it more difficult to enforce security on a codebase. This may not be a problem for many open source projects, but may be a problem for some commercial software companies.
- Git uses a SHA1 40 char hex string to identify revisions, it’s also possible to give a revision a shorter name (tag) if needed

No comments:

Post a Comment