Difference between SVN and Git

 One: What is Git?
Git is the most advanced distributed version control system in the world.

 Two: What is SVN?
SVN is the abbreviation of Subversion. It is an open source version control system. Compared with RCS and CVS, it adopts a branch management system. Its design goal is to replace CVS.
Many version control services on the Internet have migrated from CVS to Subversion. To put it simply, SVN is used for multiple people to jointly develop the same project and share resources.
SVN is a centralized version control system, and the version library is centralized on the central server.

 Three: The main difference between SVN and Git?
  SVN is a centralized version control system, the version library is centralized on the central server, and when working, all use your own computer, so you must first get the latest version from the central server,
then work, and finish After that, you need to push the work you have done to the central server. The centralized version control system must be connected to the Internet to work. If it is ok on a local area network, the bandwidth is large enough and the speed is fast enough,
if it is on the Internet, if the network speed is slow, I am puzzled.

  Git is a distributed version control system, so it does not have a central server, and everyone's computer is a complete version library. In this way, there is no need for networking when working, because the versions
are all on their own computers. Since everyone's computer has a complete repository, how can multiple people collaborate? For example, if you change file A on your computer, and others also change file A on your computer,

At this time, the two of you only need to push each other's changes to each other, and you can see each other's changes.


The difference between git and svn - a summary

1) Git is distributed, SVN is not:
This is the core difference between GIT and other non-distributed version control systems, such as SVN, CVS, etc. The advantage is that there will not be too many conflicts with other colleagues. The code written by yourself is placed on your own computer, and then submitted and merged after a period of time. You can also submit it locally without networking; GIT is not currently the first or only distribution version control system. There are also some systems, such as Bitkeeper, Mercurial, etc., that also run in distributed mode. But GIT does this better and has more powerful features.
 
Like SVN, GIT has its own centralized repository or server. However, GIT is more inclined to be used in a distributed mode, that is, each developer will clone his own repository on his own machine after checking out the code from the central repository/server. Suffice it to say that if you're stuck in a place with no internet connection, you'll still be able to commit files, view revision history, fork projects, etc.
 
2) GIT stores the content as metadata , while SVN stores it as a file:
All resource control systems hide the file's meta information in a folder like .svn, .cvs, etc. If you compare the size of the .git directory with the size of the .svn, you will find that there is a big difference. Because, the .git directory is a cloned version of the repository on your machine, and it has everything on the central repository, such as tags, branches, version records, etc.
 
3) GIT branches and SVN branches are different:
A branch is nothing special in SVN, just another directory in the repository. If you want to know if a branch was merged, you need to manually run a command like svn propget svn:mergeinfo to confirm that the code was merged. However, dealing with branches in GIT is quite simple and fun.

Git鼓励分Branch,而SVN,说实话,我用Branch的次数还挺少的,SVN自带的Branch merge我还真没用过,有merge时用的是Beyond Compare工具合并后再Commit的;

4)GIT没有一个全局的版本号,而SVN有:

目前为止这是跟SVN相比GIT缺少的最大的一个特征。

5)GIT的内容完整性要优于SVN:

GIT的内容存储使用的是SHA-1哈希算法。这能确保代码内容的完整性,确保在遇到磁盘故障和网络问题时降低对版本库的破坏。

6)Git下载下来后,在本地不必联网就可以看到所有的log,很方便学习,SVN却需要联网;

7)SVN在Commit前,我们都建议是先Update一下,跟本地的代码编译没问题,并确保开发的功能正常后再提交,这样其实挺麻烦的,有好几次同事没有先Updata,就Commit了,发生了一些错误,耽误了大家时间,Git可能这种情况会少些。

 

其他区别:

1。速度:

克隆一份全新的目录,以同样拥有五个(才五个)分支来说,SVN是同时复製5个版本的文件,也就是说重复五次同样的动作。而Git只是获取文件的每个版本的 元素,然后只载入主要的分支(master)。在我的经验,克隆一个拥有将近一万个提交(commit),五个分支,每个分支有大约1500个文件的 SVN,耗了将近一个小时!而Git只用了区区的1分鐘!

2。版本库(repository):

据我所知,SVN只能有一个指定中央版本库。当这个中央版本库有问题时,所有工作成员都一起瘫痪直到版本库维修完毕或者新的版本库设立完成。

而 Git可以有无限个版本库。或者,更正确的说法,每一个Git都是一个版本库,区别是它们是否拥有活跃目录(Git Working Tree)。如果主要版本库(例如:置於GitHub的版本库)发生了什麼事,工作成员仍然可以在自己的本地版本库(local repository)提交,等待主要版本库恢复即可。工作成员也可以提交到其他的版本库!

3.分支(Branch)
 
在SVN,分支是一个完整的目录。且这个目录拥有完整的实际文件。如果工作成员想要开啟新的分支,那将会影响“全世界”!每个人都会拥有和你一样的分支。如果你的分支是用来进行破坏工作(安检测试),那将会像传染病一样。
而 Git,每个工作成员可以任意在自己的本地版本库开啟无限个分支。举例:当我想尝试破坏自己的程序(安检测试),并且想保留这些被修改的文件供日后使用, 我可以开一个分支,做我喜欢的事。完全不需担心妨碍其他工作成员。只要我不合并及提交到主要版本库,没有一个工作成员会被影响。等到我不需要这个分支时, 我只要把它从我的本地版本库删除即可。无痛无痒。
Git的分支名是可以使用不同名字的。例如:我的本地分支名為testing,而在主要版本库的名字其实是master。 最值得一提,我可以在Git的任意一个提交点(commit point)开啟分支!(其中一个方法是使用gitk –all 可观察整个提交记录,然后在任意点开啟分支。)
 
4.提交(Commit)

在SVN,当你提交你的完成品时,它将直接记录到中央版本库。当你发现你的完成品存在严重问题时,你已经无法阻止事情的发生了。如果网路中断,你根本没办法提交!

而Git的提交完全属於本地版本库的活动。而你只需“推”(git push)到主要版本库即可。Git的“推”其实是在执行“同步”(Sync)。

 
5.重新设立起点(Rebase)
 
我没在SVN尝试过,不知道有没有这样的功能。
In Git, if you want to set someone else's latest commit as the starting point of the current branch, just execute git rebase branch_name. The difference between this and merge (merge) is that merge will be regarded as the latest according to the time of modification, while rebase will require you to resolve the conflict (conflict) where both parties have modified.
 
6. System files

SVN will place a .svn in each directory. If you want to remove these .svn is very tiring.

And Git will have a .git directory at the beginning of the directory, and a .gitignore.

 
For me, managing a Git repository is easy.
 

Replenish:
git advantages
  • Each git computer has a version library, which can do version management locally;
  • high speed. git is much faster than most version management systems, including svn
  • Powerful branch management function
  • Active open source communities such as the most famous github

git disadvantages

  • Git does not have strict permission management control. Generally, permissions are controlled by setting file read and write permissions in the system.
  • The working directory can only be the entire project. For example, checkout and branching are based on the entire project. And svn can be based on a directory in the project


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325663266&siteId=291194637