git vs svn

Git version control is a distributed. SVN is centralized. But that's just the beginning. There are also key differences in repositories, branching, and more. Keep reading for the full differences.

  • How It Works

Git software is installed on a workstation and acts as a client and a server. Every developer has a local copy of the full version history of the project on their individual machine. Git changes happen locally. So, the developer doesn’t have to be connected all the time. Once all the files are downloaded to the developer’s workstation, local operations are faster.

SVN has a separate server and client. Only the files a developer is working on are kept on the local machine, and the developer must be online, working with the server. Users check out files and commit changes back to the server.

Conflict

  • What is a merge conflict?

In every situation where work can be parallelized, work will eventually overlap. Sometimes two developers will change the same line of code in two different ways; in such a case, Git can't tell which version is correct—that's something only a developer can decide.

If this happens, a developer will see the following error during a git merge:

Auto-merging [filename1]
CONFLICT (content): Merge conflict in [filename1]
Automatic merge failed; fix conflicts and then commit the result.

Resolving merge conflicts can take a minute or they can take days (if there are a lot of files that need to be fixed). It's recommended, and good coding practice, to sync your code multiple times a day by committing, pushing, pulling, and merging often.

  • How do you resolve a git merge conflict?

Git gives a clue to resolving conflicts in its error message. It says Merge conflict in [filename1], so you know there is a problem with that file. Then it says fix conflicts and then commit the result, so if you follow directions, edit the file, then commit it, everything should work fine. Let's see this in action.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末企量,一起剝皮案震驚了整個濱河市掖桦,隨后出現(xiàn)的幾起案子软舌,更是在濱河造成了極大的恐慌盆色,老刑警劉巖桩撮,帶你破解...
    沈念sama閱讀 219,188評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件贝次,死亡現(xiàn)場離奇詭異肝箱,居然都是意外死亡叹谁,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,464評論 3 395
  • 文/潘曉璐 我一進店門期吓,熙熙樓的掌柜王于貴愁眉苦臉地迎上來早歇,“玉大人,你說我怎么就攤上這事〖” “怎么了晨另?”我有些...
    開封第一講書人閱讀 165,562評論 0 356
  • 文/不壞的土叔 我叫張陵,是天一觀的道長谱姓。 經(jīng)常有香客問我借尿,道長,這世上最難降的妖魔是什么屉来? 我笑而不...
    開封第一講書人閱讀 58,893評論 1 295
  • 正文 為了忘掉前任路翻,我火速辦了婚禮,結(jié)果婚禮上茄靠,老公的妹妹穿的比我還像新娘茂契。我一直安慰自己,他們只是感情好慨绳,可當我...
    茶點故事閱讀 67,917評論 6 392
  • 文/花漫 我一把揭開白布掉冶。 她就那樣靜靜地躺著,像睡著了一般儡蔓。 火紅的嫁衣襯著肌膚如雪郭蕉。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,708評論 1 305
  • 那天喂江,我揣著相機與錄音召锈,去河邊找鬼。 笑死获询,一個胖子當著我的面吹牛涨岁,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播吉嚣,決...
    沈念sama閱讀 40,430評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼梢薪,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了尝哆?” 一聲冷哼從身側(cè)響起秉撇,我...
    開封第一講書人閱讀 39,342評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎秋泄,沒想到半個月后琐馆,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,801評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡恒序,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,976評論 3 337
  • 正文 我和宋清朗相戀三年瘦麸,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片歧胁。...
    茶點故事閱讀 40,115評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡滋饲,死狀恐怖厉碟,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情屠缭,我是刑警寧澤箍鼓,帶...
    沈念sama閱讀 35,804評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站勿她,受9級特大地震影響袄秩,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜逢并,卻給世界環(huán)境...
    茶點故事閱讀 41,458評論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望郭卫。 院中可真熱鬧砍聊,春花似錦、人聲如沸贰军。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,008評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽词疼。三九已至俯树,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間贰盗,已是汗流浹背许饿。 一陣腳步聲響...
    開封第一講書人閱讀 33,135評論 1 272
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留舵盈,地道東北人陋率。 一個月前我還...
    沈念sama閱讀 48,365評論 3 373
  • 正文 我出身青樓,卻偏偏與公主長得像秽晚,于是被迫代替她去往敵國和親瓦糟。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 45,055評論 2 355

推薦閱讀更多精彩內(nèi)容