涓嶇啛缁?Git 琚紭鍖栦簡锛佽吘璁槸濡備綍浣跨敤 Git 鐨?锛?/h1> Posted 寮€鍙戣€呮妧鏈墠绾?/a>
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了涓嶇啛缁?Git 琚紭鍖栦簡锛佽吘璁槸濡備綍浣跨敤 Git 鐨?锛?/h1>
相关的知识,希望对你有一定的参考价值。
鐐瑰嚮鈥?/span>寮€鍙戣€呮妧鏈墠绾?/span>鈥濓紝閫夋嫨鈥滄槦鏍囸煍濃€?/span>
鍦ㄧ湅|鏄熸爣|鐣欒█, 鐪熺埍
鍥炲鈥?66鈥濓紝鑾峰彇涓€浠芥妧鏈汉涓撳睘澶хぜ鍖?nbsp;杞嚜鍏紬鍙凤細鑵捐鎶€鏈伐绋?/span>
"鍥犱负涓嶆€庝箞浼欸it锛岃嚜宸卞钩鏃跺悎浠g爜鑰佸嚭閿欙紝鏈€杩戝叕鍙歌鍛橈紝鎴戣浼樺寲浜?/strong>"锛岃鑰呭鏄銆?/span>
浠婂ぉ璺熷ぇ瀹跺垎浜竴鐐归箙鍘傜▼搴忓憳鐨?Git 浣跨敤缁忛獙銆?/span>
浠嬬粛鍥涚宸ヤ綔娴佹潵鏇村ソ鍦扮悊瑙?Git 鐨勯」鐩娇鐢ㄦ祦绋嬶紝鍒╃敤鍏跺己澶х殑鍒嗘敮鍔熻兘涓鸿嚜宸辩殑椤圭洰鏋勭瓚閫傞厤鐨勫伐浣滄祦銆?/span>
1. 鍓嶈█
寮€鍙戜汉鍛樺湪鏃ュ父寮€鍙戣繃绋嬩腑锛屼笉鍙伩鍏嶅湴浼氫娇鐢ㄥ埌浠g爜鐨勭増鏈帶鍒跺伐鍏凤紝濡?svn銆乬it 绛夌瓑锛岃寰楀湪鍒氬垰鍏ヨ亴鐨勬椂鍊欙紝閮ㄩ棬浣跨敤鐨勪富瑕佺殑 VCS 宸ュ叿杩樻槸 svn锛屾湡闂存湁鐫€闈炲父鐥涜嫤鐨?download 缁忓巻锛屼笅杞戒竴浠戒粨搴撹姳浜嗘垜 2-3 涓皬鏃讹紝鐩告瘮浜?svn锛実it 鏈夌潃闈炲父澶氱殑浼樺娍锛屾瘮濡備粨搴?clone 閫熷害闈炲父蹇€佹牳蹇冪殑鍒嗘敮鍔熻兘绛夌瓑锛屽悗缁叕鍙镐篃鍦ㄦ帹浣跨敤 git 鏉ョ淮鎶や唬鐮佷粨搴擄紝瀹屽叏鎽掑純绗ㄩ噸鐨?svn銆?/span>
閭d箞锛屽垏鎹㈠埌 git 鏉ョ淮鎶や唬鐮佷粨搴擄紝浼氬鎴戜滑鐨勬棩甯稿紑鍙戦€犳垚褰卞搷鍚楋紵绛斿簲鏄樉鐒剁殑锛岄鍏堟垜浠渶瑕佸涔?git 鐨勫熀鏈蹇典笌鐢ㄦ硶锛岀劧鍚庡氨闇€瑕佹垜浠湪鍏蜂綋鐨勯」鐩疄璺佃繃绋嬩腑鎵撶(鎴戜滑鐨?git 浣跨敤鎶€宸э紝姣斿鐏垫椿鐨勫垎鏀€佸瓙妯″潡浣跨敤绛夌瓑锛屽叧浜?git 姒傚康鎴栨妧鏈笂鐨勪粙缁嶏紝鏈枃涓嶄簣灞曞紑锛屽鏋滃 git 瀹炵幇涓婄殑缁嗚妭鎰熷叴瓒g殑璇濓紝鍙互鑷鎼滅储瀛︿範銆?/span>
鎺ヤ笅鏉ヤ富瑕佽窡澶у鎺㈣鐨勪富棰樻槸 git 宸ヤ綔娴侊紝git 鍒濆鑰呭彲鑳藉杩欎釜姒傚康骞朵笉鏄緢娓呮櫚锛岃剳娴蜂腑鎯冲埌鐨勫彲鑳芥槸 git 鐨勫伐浣滃師鐞嗕箣绫荤殑锛屽叾瀹炲苟涓嶆槸鐨勶紝git 宸ヤ綔娴佹寚鐨勬槸澶氫汉鍗忎綔杩囩▼涓殑 git 鐨勪娇鐢ㄦ祦绋嬶紝涓嶆秹鍙婃妧鏈粏鑺傦紝鏄竴绉嶉」鐩鐞嗐€佸紑鍙戠害瀹氱殑鏂瑰紡銆傛湁浜涘悓瀛﹀彲鑳借寰椾範寰椾簡 git 涓夋澘鏂э紙clone銆乤dd commit銆乸ush锛夊氨绠楁槸瀹屾垚浜嗗 git 鐨勫紑鍙戣鐭ワ紝鍏跺疄鍜变滑鍙兘杩樺仠鐣欏湪鏈€鍘熷鐨勬兂璞′箣涓€?/span>
2. 闆嗕腑寮忓伐浣滄祦
闆嗕腑寮忓伐浣滄祦锛岃繖绉嶅伐浣滄柟寮忓浜庝娇鐢ㄨ繃 svn 鐨勫悓瀛︽兂蹇呬細闈炲父鐨勭啛鎮夛紝璁╂垜浠€濊€冧笅鍦?svn 涓嬬殑鍗忎綔浣撻獙锛屼笉鍚岀殑寮€鍙戝悓瀛﹂渶瑕佷緷娆″皢鏈湴鐨勪慨鏀规彁浜ゅ埌鏈嶅姟鍣紝濡傛灉鏈夊啿绐佸氨鍏堣В鍐虫湰鍦扮殑鍐茬獊鍐嶆彁浜わ紝杩欎釜杩囩▼涓繙绔殑鏈嶅姟鍣ㄥ氨鍍忔槸涓€涓泦涓鐞嗚€咃紝绠$悊鐫€鎵€鏈変汉鐨勪唬鐮佹彁浜わ紝鎵€浠?svn 鐨勫紑鍙戝崗浣滄祦绋嬪氨鏄吀鍨嬬殑闆嗕腑寮忓伐浣滄祦锛岄偅鍒囨崲鍒?git 鍦烘櫙涓嬶紝闆嗕腑寮忓伐浣滄祦鐨勫伐浣滄柟寮忓張鏄粈涔堟牱鐨勫憿锛?/span>
棣栧厛鎴戜滑鐪嬩笅 git 鐨勫熀纭€鎿嶄綔妗嗘灦锛屽鍥?2.1 鎵€绀猴細
杩欓噷鏈変竴浠戒腑澶粨搴擄紝鏄瓨鏀鹃」鐩唬鐮佺殑鍦版柟锛屼笁涓紑鍙戜汉鍛?A銆丅銆丆 鍒嗗埆鍦ㄦ湰鍦版寔鏈変竴浠戒腑澶粨搴撶殑鎷疯礉 - 鏈湴浠撳簱锛岃繖閲岀浉姣斾簬 svn 鐨勬鏋跺彧鏄浜嗕竴涓湰鍦颁粨搴擄紱
鎺ヤ笅鏉ユ垜浠啀鏉ョ湅鍦ㄩ」鐩紑鍙戣繘琛屼簡涓€娈垫椂闂翠箣鍚庣殑鎻愪氦鏃ュ織鏄粈涔堟牱鐨勶紝濡傚浘 2.2 鎵€绀猴細
杩欓噷鏄竴鏉℃渶绠€鍗曠殑 master 鍒嗘敮涓婄殑鎻愪氦鏃ュ織璁板綍锛岄偅鐩告瘮浜?svn 鐨勬鏋舵湁鍟ュ尯鍒憿锛屽彧瑕佹妸 master 鍒嗘敮瀛楁牱鏀规垚 trunk 灏卞彉鎴愪簡涓€鏉?svn 鐨勬彁浜よ褰曘€?/span>
鏈€鍚庯紝鎴戜滑鑰冭檻浠ヤ笅鍑犱釜鏉′欢锛?/span>
1銆佹湁鏃犳湰鍦颁粨搴?/span>2銆侀粯璁ゅ垎鏀槸 master 杩樻槸 trunk3銆佹彁浜ゆ搷浣滀娇鐢?git command 杩樻槸 svn command锛堢粏鑺傚拷鐣ワ級
鎴戜滑鍙互鐪嬪嚭 svn 涓嬬殑闆嗕腑寮忓伐浣滄祦鍚屾牱閫傜敤浜?git锛屽彧瑕佸ぇ瀹舵妸 svn 鐩稿叧鐨勬蹇靛叏閮ㄥ垏鎹㈠埌 git 涓嬪嵆鍙細1銆佽璇嗘湰鍦颁粨搴?/span>2銆佽璇嗛粯璁ゅ垎鏀?master3銆佷娇鐢?git 鐨勬彁浜ゅ懡浠?/span>
浠ヤ笂涓夌偣涓殑鍓嶄袱鐐瑰浜庨泦涓紡宸ヤ綔娴佷笅鐨勫紑鍙戣€呭叾瀹炴槸閫忔槑鐨勶紝寮€鍙戣€呭彧闇€瑕佸皢鎻愪氦鍛戒护鏀规垚 git 灏卞彲浠ユ棤缂濊鎺?svn 涓嬬殑闆嗕腑寮忓伐浣滄祦锛?/span>
鎵€浠ワ紝svn 鍒囨崲鍒?git 鐨勬垚鏈叾瀹炶繕鏄緢浣庣殑锛屽彧闇€瑕佷綘鎺屾彙 git 鐨勫熀纭€鎻愪氦鍛戒护锛?/span>
git 涓嬬殑闆嗕腑寮忓伐浣滄祦锛屾槸涓€绉嶅彧浣跨敤 master 涓诲垎鏀殑寮€鍙戞柟寮忥紝杩欑鏂瑰紡绠€鍗曟槑浜嗭紝浣嗘槸缂虹偣鏄笉鍚屽紑鍙戜汉鍛樼殑鎻愪氦鏃ュ織娣锋潅鍦ㄤ竴璧凤紝闅句互瀹氫綅闂銆?/span>
3. 鍔熻兘鍒嗘敮宸ヤ綔娴?/span>
鍔熻兘鍒嗘敮宸ヤ綔娴侊紝杩欑宸ヤ綔鏂瑰紡鏄互闆嗕腑寮忓伐浣滄祦涓哄熀纭€锛屽啀涓轰笉鍚屽姛鑳藉紑鍙戝垎閰嶅崟鐙殑鍔熻兘鍒嗘敮鏉ヨ繘琛岀殑锛涜繖绉嶅伐浣滄祦鐨勪富骞插垎鏀粛鐒舵槸 master 鍒嗘敮锛屼絾鏄紑鍙戣€呭湪杩涜鏃ュ父闇€姹傚紑鍙戞椂涓嶈兘灏嗕唬鐮佺洿鎺ユ彁浜ゅ埌 master 鍒嗘敮涓婏紝涓€鑸槸涓虹壒瀹氱殑闇€姹傛柊寤轰竴涓姛鑳藉垎鏀紝骞朵笖鍙栦竴涓叿鏈夋弿杩版€х殑鍚嶅瓧锛屼緥濡傦細feat-personal-page銆乮ssue-#1702锛屾弿杩版€х殑鍚嶇О鍙互璁╁叾浠栧紑鍙戣€呭揩閫熷湴鏄庣櫧杩欎釜鍔熻兘鍒嗘敮鐨勪富瑕佷綔鐢紝鎻愰珮涓嶅悓寮€鍙戣€呬箣闂寸殑鍗忓悓鏁堢巼锛涘姛鑳藉垎鏀姛鑳芥祦鐨勬彁浜ゆ棩蹇楄褰曞鍥?3.1 鎵€绀猴細
浠庡浘涓彲浠ョ湅鍑猴紝鐩告瘮浜庨泦涓紡宸ヤ綔娴侊紝鍒嗘敮鍘嗗彶鐪嬭捣鏉ユ洿鍔犵畝娲併€佸悎鐞嗭紝璁╀笉鍚屽姛鑳界殑寮€鍙戣繘琛岄殧绂伙紝閬垮厤涓嶅悓鍔熻兘浠g爜涔嬮棿浜х敓涓嶅埄鐨勫奖鍝嶃€?/span>
姝ゅ锛屽湪鍔熻兘鍒嗘敮涓婄殑闇€姹傚紑鍙戝畬鎴愪箣鍚庯紝鎴戜滑闇€瑕佸皢鍒嗘敮鍚堝苟鍒颁富骞插垎鏀?master 涓婏紝杩欐椂鍊欓渶瑕佽繘琛岀殑鎿嶄綔鏄?pull request锛屼负浠€涔堣杩涜 PR 鎿嶄綔锛岃€屼笉鏄洿鎺ヨ繘琛屼唬鐮佺殑 merge 鍛紝杩欓噷棣栧厛闇€瑕佸ぇ瀹惰璇?PR 鏄粈涔堟搷浣滐紝鍏舵闇€瑕佸ぇ瀹朵簡瑙?PR 鎿嶄綔鐨勬剰涔夛紱
鍔熻兘闇€姹傚紑鍙戝畬鎴愪箣鍚庯紝闇€瑕佸皢鏈湴鍔熻兘鍒嗘敮鎺ㄩ€佸埌涓ぎ浠撳簱鐨勫姛鑳藉垎鏀笂锛岀劧鍚庡湪涓ぎ浠撳簱鐨勫姛鑳藉垎鏀笂鍙戣捣涓€涓?pull request 璇锋眰鍘诲皢鍔熻兘鍒嗘敮涓婄殑淇敼鍚堝苟鍒?master 鍒嗘敮涓婏紝杩欎釜杩囩▼涓€鑸槸鍦?GIT 鐨勯」鐩富椤典笂杩涜锛屽叕鍙稿唴閮ㄥ氨宸ヨ渹鐨勯」鐩富椤碉紝濡傚浘 3.2 鎵€绀猴紝鏄?flutter 椤圭洰鐨勬煇涓€娆?PR 璇︽儏锛?/span>
PR 鎿嶄綔缁欓」鐩甫鏉ョ殑鐩婂鏈変袱鐐癸細1銆乧ode review2銆佽璁轰唬鐮佺殑鍏叡骞冲彴
鍓嶈€呮槸姣忔 PR 鎿嶄綔鍙戠敓鏃朵細閫氱煡鐩稿叧鑰呮潵妫€鏌ュ緟鍚堝苟鐨勪唬鐮侊紝鍦ㄦ鏌ヨ繃绋嬩腑鍗冲畬鎴愪簡瀵逛唬鐮佺殑妫€瑙嗭紝杩欎釜杩囩▼淇濋殰浜?master 鍒嗘敮涓婄殑宸插悎骞朵唬鐮佺殑鍋ュ.鎬э紱鍚庤€呭垯鏄洜涓烘瘡娆?PR 閮戒細鏈変竴涓?PR 璇︽儏涓婚〉锛屽鍥?3.2锛屾瘡涓€涓紑鍙戣€呴兘鍙互閽堝浠g爜鐨勫疄鐜版彁鍑鸿嚜宸辩殑鎰忚锛屼娇寰楄璁轰唬鐮佸彉鎴愭洿鍔犱究鎹烽珮鏁堬紝涓斾负浠g爜鍙樻洿鍥為【鎻愪緵浜嗗彲鑳姐€?/span>
鍔熻兘鍒嗘敮宸ヤ綔娴佹槸 git 椤圭洰寮€鍙戦潪甯哥伒娲讳娇鐢ㄧ殑涓€绉嶆柟寮忥紝浣嗘槸瀵逛簬澶у瀷鐨勯」鐩€岃█锛岄渶瑕佷负涓嶅悓鐨勫垎鏀垎閰嶆洿鍔犲叿浣撶殑瑙掕壊銆?/span>
4.Gitflow 宸ヤ綔娴?/span>
Gitflow 宸ヤ綔娴佹槸鐩墠闈炲父鎴愮啛鐨勪竴涓柟妗堬紝瀹冨畾涔変簡涓€涓洿缁曢」鐩彂甯冪殑涓ユ牸鍒嗘敮妯″瀷锛岄€氳繃涓轰唬鐮佺爺鍙戙€侀」鐩彂甯冧互鍙婄淮鎶ゅ垎閰嶇嫭绔嬬殑鍒嗘敮鏉ヨ椤圭洰鐨勮凯浠h繃绋嬫洿鍔犲湴椤虹晠锛屼笉鍚屼簬涔嬪墠鐨勯泦涓紡宸ヤ綔娴佷互鍙婂姛鑳藉垎鏀伐浣滄祦锛実itflow 宸ヤ綔娴佸父椹荤殑鍒嗘敮鏈変袱涓細涓诲共鍒嗘敮 master銆佸紑鍙戝垎鏀?dev锛屾澶栭拡瀵归」鐩爺鍙戠殑鍚勪釜闃舵锛岃瀹氫簡鐗瑰畾鐨勫垎鏀€?/span>
闃舵鍒嗘敮甯搁┗ master銆乨ev 鐮斿彂 feature 鐑慨澶?hotfix 鍙戝竷 release
棣栧厛閽堝甯搁┗鍒嗘敮锛屽鍥?4.1
甯搁┗鍒嗘敮琛ㄧず鍦ㄩ」鐩彁浜ゅ巻鍙蹭腑涓€鐩村瓨鍦ㄧ殑鍒嗘敮锛岃繖閲?master 鍒嗘敮涓昏璺熻釜椤圭洰姝e紡鍙戝竷鐨勪唬鐮佸巻鍙诧紝dev 鍒嗘敮涓昏璺熻釜椤圭洰浠g爜鐮斿彂鐨勬彁浜ゅ巻鍙诧紱姝ゅ鍦?master 鍒嗘敮涓婇€氬父浼氫负鏌愭鐗堟湰鍙戝竷鍒嗛厤涓€涓爣绛炬潵璁板綍鐗堟湰鍙凤紝杩欎负浠ュ悗椤圭洰鎺掓煡瀹氫綅鎻愪緵渚垮埄銆?/span>
鎺ヤ笅鏉ワ紝鎴戜滑鏉ョ湅 gitflow 宸ヤ綔娴佷腑锛屼唬鐮佺爺鍙戦樁娈电殑宸ヤ綔娴佺▼銆?/span>
濡傚浘 4.2 鎵€绀猴紝寮€鍙戦樁娈靛紑鍚煇涓€涓渶姹傛椂闇€瑕佷粠 dev 鍒嗘敮涓婃柊寤哄姛鑳藉垎鏀?feature锛屽浘涓墍绀轰负涓や釜 feature 鍒嗘敮锛屼唬琛ㄥ悓鏃舵湁涓や釜鍔熻兘鍦ㄥ紑鍙戜腑锛岃繖閲岀殑 feature 鍒嗘敮浣跨敤璺熷姛鑳藉垎鏀伐浣滄祦涓殑浣跨敤鏂瑰紡鏄竴鏍风殑锛屽湪闇€姹傚紑鍙戝畬鎴愪箣鍚庨渶瑕佹彁浜?PR 璇锋眰鍚堝苟杩?dev 鍒嗘敮锛屽畬鎴愪箣鍚庡嵆鍙垹闄ゅ搴旂殑鍔熻兘鍒嗘敮銆?/span>
寰堝鏃跺€欙紝鍦ㄩ渶姹傜爺鍙戣繃绋嬩腑锛岀嚎涓婄殑浠g爜鍙兘浼氬嚭鐜伴棶棰橈紝杩欐椂鍊欓渶瑕佹垜浠繘琛屽強鏃剁殑淇锛岃繖灏辨槸椤圭洰杩唬杩囩▼涓殑鐑慨澶嶉樁娈点€?/span>
濡傚浘 4.3 鎵€绀猴紝鍋囪鎴戜滑鍦ㄥ紑鍙戠殑杩囩▼涓嚎涓婂嚭鐜颁簡涓€涓?bug锛岃繖鏃跺€欐垜浠渶瑕佷粠 master 鐨勬爣绛?v0.1 涓婃鍑轰竴浠藉垎鏀唬鐮?hotfix锛屼慨澶嶅苟楠岃瘉濂戒簡涔嬪悗锛岄渶瑕佸皢 hotfix 浠g爜鍒嗗埆鍚堝苟鍒?master /dev 鍒嗘敮涓婏紝骞跺湪 master 鐨勬彁浜や笂鎵撲笂涓€涓爣绛?v0.2锛岃繖閲岄渶瑕佸皢鐑慨澶嶇殑浠g爜鍒嗗埆鍚堝苟杩涗袱涓父椹诲垎鏀槸鍥犱负闇€瑕佷繚闅滀袱杈逛唬鐮佺殑涓€鑷存€с€?/span>
鏈€鍚庯紝鎴戜滑鏉ョ湅涓嬮」鐩凯浠g殑鍙戝竷闃舵锛屾垜浠渶瑕佸皢涔嬪墠鍔熻兘寮€鍙戝畬鎴愮殑鐗规€у彂甯冨埌绾夸笂鍘伙紝濡傚浘 4.4 鎵€绀?/span>
棣栧厛鍦?dev 鍒嗘敮鐨勬彁浜ゅ鏂板缓 release 鍒嗘敮锛屽湪杩欎釜鍒嗘敮涓婅繘琛?bug 淇銆侀潰鍚戝彂甯冪殑涓€浜涗换鍔★紝杩欎釜鍒嗘敮涓嶅仛浠讳綍鍔熻兘涓婄殑浠诲姟锛屽畬鎴愪箣鍚庡皢 release 鍒嗘敮鍐嶅垎鍒悎骞惰繘 master/dev 鍒嗘敮锛屽苟鍦?master 鎻愪氦涓婃墦涓婃爣绛?v1.0锛岃繖鏍蜂竴涓彂甯冮樁娈电殑浠g爜鎿嶄綔灏卞畬鎴愪簡
鏈€鍚庢垜浠潵鐪嬪彂甯冧箣鍚庣殑鐩墠鐨勬棩蹇楄褰曟儏鍐碉紝濡傚浘 4.5 鎵€绀猴紝杩欓噷鍙互灏嗘病鏈夌敤鐨勫垎鏀?hotfix銆乺elease銆乫eature 鍧囧垹闄や簡锛屽彲浠ョ湅鍑烘垜浠殑甯搁┗鍒嗘敮灏?master/dev锛屾渶涓嬮潰鐨?feature 琛ㄧず浠嶅湪寮€鍙戜腑銆?/span>
gitflow 宸ヤ綔娴佹槸鐩墠姣旇緝寰堟垚鐔熺殑鏂规锛屽畠鐨勪紭鐐规湁锛?/span>
1銆佸彂甯冭凯浠f祦绋嬫洿椤虹晠2銆佷娇寰椾唬鐮佹湁浜嗘洿鍔犱弗璋ㄧ殑椤圭洰缁撴瀯锛屾柟渚垮畾浣嶆帓鏌ラ棶棰?/span>
澶у瀷鐨勯」鐩?/ 杩唬閫熷害蹇殑鎺ㄨ崘浣跨敤杩欑宸ヤ綔娴佺▼锛?/span>
5.Forking 宸ヤ綔娴?/span>
鏈€鍚庝粙缁嶄竴绉嶅紑婧愰」鐩父鐢ㄧ殑宸ヤ綔娴?鈥斺€擣orking 宸ヤ綔娴侊紝浠嬬粛涔嬪墠棣栧厛闇€瑕佷簡瑙d粈涔堟槸 fork 鎿嶄綔锛屽鍥?5.1 鎵€绀?/span>
fork 鎿嶄綔鏄湪涓汉杩滅▼浠撳簱鏂板缓涓€浠界洰鏍囪繙绋嬩粨搴撶殑鎷疯礉锛屾搷浣滃緢绠€鍗曪紝姣斿 github 涓婂湪椤圭洰鐨勪富椤电偣鍑?fork 鎸夐挳鍗冲彲銆?/span>
鏄庣櫧浜?fork 鎿嶄綔涔嬪悗锛屾垜浠潵鐪嬩笅 forking 宸ヤ綔娴佺殑娴佺▼锛屽鍥?5.2 鎵€绀猴細
棣栧厛寮€鍙戣€?A 鎷ユ湁涓€涓繙绔粨搴擄紝杩欐椂鍊欐湁涓€涓紑鍙戣€?C 涔熸兂鍙備笌 A 鐨勮繖涓」鐩殑寮€鍙戝伐浣滐紝閭d粬灏卞彲浠?fork 涓€浠?A 鐨勮繖涓粨搴擄紝涔嬪悗鍦?c 鐨勪釜浜轰粨搴撻噷灏辨湁浜嗚繖浠戒唬鐮佸簱锛屽悗缁紑鍙戣€?C 灏卞彲浠ュ湪鑷繁鐨勮繖涓」鐩噷杩涜寮€鍙戝伐浣滐紝c 鍦ㄥ畬鎴愪簡鏌愪釜鍔熻兘鐨勫疄鐜颁箣鍚庯紝鍙互缁?A 鐨勪粨搴撳彂涓€涓?PR 璇锋眰锛岃繖鏃跺€欎細閫氱煡鍒板紑鍙戣€?A 鏈夋柊鐨?PR锛孉 濡傛灉鏈夐棶棰樺彲浠ョ洿鎺ュ湪杩欎釜 PR 閲屾彁锛屽紑鍙戣€?C 鍙互杩涜杩涗竴姝ョ殑淇敼锛屾渶鍚?A 閫氳繃浜?C 鐨勮繖浠?PR 璇锋眰锛屽氨浼氬皢 C 鐨勪唬鐮佸悎骞惰繘 A 鐨勪粨搴擄紝杩欐牱灏卞畬鎴愪簡 A / 浠g爜搴撴柊鐗规€х殑寮€鍙戙€傚悓鏃跺鏋滄湁鍏朵粬寮€鍙戣€呭 A 鐨勯」鐩湁鍏磋叮涔熶細杩涜鐩稿悓鐨勬搷浣溿€?/span>
杩欓噷娉ㄦ剰鍒?寮€鍙戣€?B/C 骞朵笉鏄?A 浠g爜搴撶殑寮€鍙戜汉鍛橈紝鑰屾槸绗笁鏂瑰紑鍙戣€咃紝鎵€浠ヨ繖绉嶅伐浣滄祦涓昏鐢ㄤ簬寮€婧愰」鐩紒
6. 鎬荤粨
鏈€鍚庡洖椤句笅杩欏嚑绉?git 宸ヤ綔娴侊紝闆嗕腑寮忓伐浣滄祦鍙互璇存槸 git 宸ヤ綔娴佺殑鍩虹锛屽垵瀛﹁€呭彲浠ユ棤缂濆湴浠?svn 鐨勬ā寮忓垏鎹㈠埌 git 鐨勬ā寮忥紱鍔熻兘鍒嗘敮宸ヤ綔娴佸湪闆嗕腑寮忕殑鍩虹涓婂張寮曞叆浜嗗姛鑳藉垎鏀紝鐏垫椿鍦板埄鐢ㄤ簡 git 鐨勫垎鏀壒鎬э紝鍔熻兘鍒嗙 / PR 浼樺寲浜嗘棩甯稿伐浣滅殑鏁堢巼锛沢itflow 宸ヤ綔娴佸垯鏄负澶у瀷椤圭洰鐨勮凯浠h繃绋嬫湇鍔$殑锛屾寚瀹氫簡涓€涓弗鏍肩殑鍒嗘敮妯″瀷锛屼娇寰楄凯浠f祦绋嬫洿鍔犻『鐣咃紱forking 宸ヤ綔娴佸垯鏄紑婧愰」鐩殑棣栭€夛紝鎯宠涓哄紑婧愰」鐩仛璐$尞灏卞繀椤昏鎳傚緱杩欑宸ヤ綔娴侊紒
褰撶劧锛屼互涓婃弿杩扮殑杩欎簺宸ヤ綔娴佸苟涓嶆槸瀹為檯宸ヤ綔涓?git 浣跨敤鐨勫噯鍒欙紝杩欏彧鏄竴浜涙帹鑽愮殑浣跨敤鏂瑰紡锛屽湪鍏蜂綋鐨勯」鐩爺鍙戣繃绋嬩腑锛屾垜浠渶瑕佺粨鍚堥」鐩互鍙婂洟闃熺幇鐘朵綔鍑哄彇鑸嶏紝鎬荤粨鍑洪€傚悎鑷繁鍥㈤槦鐨勫伐浣滄祦锛屾墠鑳借 git 鏇村ソ鍦颁负鎴戜滑鏈嶅姟锛?/span>
以上是关于涓嶇啛缁?Git 琚紭鍖栦簡锛佽吘璁槸濡備綍浣跨敤 Git 鐨?锛?/h1>
Posted 寮€鍙戣€呮妧鏈墠绾?/a>
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了涓嶇啛缁?Git 琚紭鍖栦簡锛佽吘璁槸濡備綍浣跨敤 Git 鐨?锛?/h1>
鐐瑰嚮鈥?/span>寮€鍙戣€呮妧鏈墠绾?/span>鈥濓紝閫夋嫨鈥滄槦鏍囸煍濃€?/span>
鍦ㄧ湅|鏄熸爣|鐣欒█, 鐪熺埍
鍥炲鈥?66鈥濓紝鑾峰彇涓€浠芥妧鏈汉涓撳睘澶хぜ鍖?nbsp;杞嚜鍏紬鍙凤細鑵捐鎶€鏈伐绋?/span>
"鍥犱负涓嶆€庝箞浼欸it锛岃嚜宸卞钩鏃跺悎浠g爜鑰佸嚭閿欙紝鏈€杩戝叕鍙歌鍛橈紝鎴戣浼樺寲浜?/strong>"锛岃鑰呭鏄銆?/span>
浠婂ぉ璺熷ぇ瀹跺垎浜竴鐐归箙鍘傜▼搴忓憳鐨?Git 浣跨敤缁忛獙銆?/span>
浠嬬粛鍥涚宸ヤ綔娴佹潵鏇村ソ鍦扮悊瑙?Git 鐨勯」鐩娇鐢ㄦ祦绋嬶紝鍒╃敤鍏跺己澶х殑鍒嗘敮鍔熻兘涓鸿嚜宸辩殑椤圭洰鏋勭瓚閫傞厤鐨勫伐浣滄祦銆?/span>
1. 鍓嶈█
寮€鍙戜汉鍛樺湪鏃ュ父寮€鍙戣繃绋嬩腑锛屼笉鍙伩鍏嶅湴浼氫娇鐢ㄥ埌浠g爜鐨勭増鏈帶鍒跺伐鍏凤紝濡?svn銆乬it 绛夌瓑锛岃寰楀湪鍒氬垰鍏ヨ亴鐨勬椂鍊欙紝閮ㄩ棬浣跨敤鐨勪富瑕佺殑 VCS 宸ュ叿杩樻槸 svn锛屾湡闂存湁鐫€闈炲父鐥涜嫤鐨?download 缁忓巻锛屼笅杞戒竴浠戒粨搴撹姳浜嗘垜 2-3 涓皬鏃讹紝鐩告瘮浜?svn锛実it 鏈夌潃闈炲父澶氱殑浼樺娍锛屾瘮濡備粨搴?clone 閫熷害闈炲父蹇€佹牳蹇冪殑鍒嗘敮鍔熻兘绛夌瓑锛屽悗缁叕鍙镐篃鍦ㄦ帹浣跨敤 git 鏉ョ淮鎶や唬鐮佷粨搴擄紝瀹屽叏鎽掑純绗ㄩ噸鐨?svn銆?/span>
閭d箞锛屽垏鎹㈠埌 git 鏉ョ淮鎶や唬鐮佷粨搴擄紝浼氬鎴戜滑鐨勬棩甯稿紑鍙戦€犳垚褰卞搷鍚楋紵绛斿簲鏄樉鐒剁殑锛岄鍏堟垜浠渶瑕佸涔?git 鐨勫熀鏈蹇典笌鐢ㄦ硶锛岀劧鍚庡氨闇€瑕佹垜浠湪鍏蜂綋鐨勯」鐩疄璺佃繃绋嬩腑鎵撶(鎴戜滑鐨?git 浣跨敤鎶€宸э紝姣斿鐏垫椿鐨勫垎鏀€佸瓙妯″潡浣跨敤绛夌瓑锛屽叧浜?git 姒傚康鎴栨妧鏈笂鐨勪粙缁嶏紝鏈枃涓嶄簣灞曞紑锛屽鏋滃 git 瀹炵幇涓婄殑缁嗚妭鎰熷叴瓒g殑璇濓紝鍙互鑷鎼滅储瀛︿範銆?/span>
鎺ヤ笅鏉ヤ富瑕佽窡澶у鎺㈣鐨勪富棰樻槸 git 宸ヤ綔娴侊紝git 鍒濆鑰呭彲鑳藉杩欎釜姒傚康骞朵笉鏄緢娓呮櫚锛岃剳娴蜂腑鎯冲埌鐨勫彲鑳芥槸 git 鐨勫伐浣滃師鐞嗕箣绫荤殑锛屽叾瀹炲苟涓嶆槸鐨勶紝git 宸ヤ綔娴佹寚鐨勬槸澶氫汉鍗忎綔杩囩▼涓殑 git 鐨勪娇鐢ㄦ祦绋嬶紝涓嶆秹鍙婃妧鏈粏鑺傦紝鏄竴绉嶉」鐩鐞嗐€佸紑鍙戠害瀹氱殑鏂瑰紡銆傛湁浜涘悓瀛﹀彲鑳借寰椾範寰椾簡 git 涓夋澘鏂э紙clone銆乤dd commit銆乸ush锛夊氨绠楁槸瀹屾垚浜嗗 git 鐨勫紑鍙戣鐭ワ紝鍏跺疄鍜变滑鍙兘杩樺仠鐣欏湪鏈€鍘熷鐨勬兂璞′箣涓€?/span>
2. 闆嗕腑寮忓伐浣滄祦
闆嗕腑寮忓伐浣滄祦锛岃繖绉嶅伐浣滄柟寮忓浜庝娇鐢ㄨ繃 svn 鐨勫悓瀛︽兂蹇呬細闈炲父鐨勭啛鎮夛紝璁╂垜浠€濊€冧笅鍦?svn 涓嬬殑鍗忎綔浣撻獙锛屼笉鍚岀殑寮€鍙戝悓瀛﹂渶瑕佷緷娆″皢鏈湴鐨勪慨鏀规彁浜ゅ埌鏈嶅姟鍣紝濡傛灉鏈夊啿绐佸氨鍏堣В鍐虫湰鍦扮殑鍐茬獊鍐嶆彁浜わ紝杩欎釜杩囩▼涓繙绔殑鏈嶅姟鍣ㄥ氨鍍忔槸涓€涓泦涓鐞嗚€咃紝绠$悊鐫€鎵€鏈変汉鐨勪唬鐮佹彁浜わ紝鎵€浠?svn 鐨勫紑鍙戝崗浣滄祦绋嬪氨鏄吀鍨嬬殑闆嗕腑寮忓伐浣滄祦锛岄偅鍒囨崲鍒?git 鍦烘櫙涓嬶紝闆嗕腑寮忓伐浣滄祦鐨勫伐浣滄柟寮忓張鏄粈涔堟牱鐨勫憿锛?/span>
棣栧厛鎴戜滑鐪嬩笅 git 鐨勫熀纭€鎿嶄綔妗嗘灦锛屽鍥?2.1 鎵€绀猴細
杩欓噷鏈変竴浠戒腑澶粨搴擄紝鏄瓨鏀鹃」鐩唬鐮佺殑鍦版柟锛屼笁涓紑鍙戜汉鍛?A銆丅銆丆 鍒嗗埆鍦ㄦ湰鍦版寔鏈変竴浠戒腑澶粨搴撶殑鎷疯礉 - 鏈湴浠撳簱锛岃繖閲岀浉姣斾簬 svn 鐨勬鏋跺彧鏄浜嗕竴涓湰鍦颁粨搴擄紱
鎺ヤ笅鏉ユ垜浠啀鏉ョ湅鍦ㄩ」鐩紑鍙戣繘琛屼簡涓€娈垫椂闂翠箣鍚庣殑鎻愪氦鏃ュ織鏄粈涔堟牱鐨勶紝濡傚浘 2.2 鎵€绀猴細
杩欓噷鏄竴鏉℃渶绠€鍗曠殑 master 鍒嗘敮涓婄殑鎻愪氦鏃ュ織璁板綍锛岄偅鐩告瘮浜?svn 鐨勬鏋舵湁鍟ュ尯鍒憿锛屽彧瑕佹妸 master 鍒嗘敮瀛楁牱鏀规垚 trunk 灏卞彉鎴愪簡涓€鏉?svn 鐨勬彁浜よ褰曘€?/span>
鏈€鍚庯紝鎴戜滑鑰冭檻浠ヤ笅鍑犱釜鏉′欢锛?/span>
1銆佹湁鏃犳湰鍦颁粨搴?/span>2銆侀粯璁ゅ垎鏀槸 master 杩樻槸 trunk3銆佹彁浜ゆ搷浣滀娇鐢?git command 杩樻槸 svn command锛堢粏鑺傚拷鐣ワ級
鎴戜滑鍙互鐪嬪嚭 svn 涓嬬殑闆嗕腑寮忓伐浣滄祦鍚屾牱閫傜敤浜?git锛屽彧瑕佸ぇ瀹舵妸 svn 鐩稿叧鐨勬蹇靛叏閮ㄥ垏鎹㈠埌 git 涓嬪嵆鍙細1銆佽璇嗘湰鍦颁粨搴?/span>2銆佽璇嗛粯璁ゅ垎鏀?master3銆佷娇鐢?git 鐨勬彁浜ゅ懡浠?/span>
浠ヤ笂涓夌偣涓殑鍓嶄袱鐐瑰浜庨泦涓紡宸ヤ綔娴佷笅鐨勫紑鍙戣€呭叾瀹炴槸閫忔槑鐨勶紝寮€鍙戣€呭彧闇€瑕佸皢鎻愪氦鍛戒护鏀规垚 git 灏卞彲浠ユ棤缂濊鎺?svn 涓嬬殑闆嗕腑寮忓伐浣滄祦锛?/span>
鎵€浠ワ紝svn 鍒囨崲鍒?git 鐨勬垚鏈叾瀹炶繕鏄緢浣庣殑锛屽彧闇€瑕佷綘鎺屾彙 git 鐨勫熀纭€鎻愪氦鍛戒护锛?/span>
git 涓嬬殑闆嗕腑寮忓伐浣滄祦锛屾槸涓€绉嶅彧浣跨敤 master 涓诲垎鏀殑寮€鍙戞柟寮忥紝杩欑鏂瑰紡绠€鍗曟槑浜嗭紝浣嗘槸缂虹偣鏄笉鍚屽紑鍙戜汉鍛樼殑鎻愪氦鏃ュ織娣锋潅鍦ㄤ竴璧凤紝闅句互瀹氫綅闂銆?/span>
3. 鍔熻兘鍒嗘敮宸ヤ綔娴?/span>
鍔熻兘鍒嗘敮宸ヤ綔娴侊紝杩欑宸ヤ綔鏂瑰紡鏄互闆嗕腑寮忓伐浣滄祦涓哄熀纭€锛屽啀涓轰笉鍚屽姛鑳藉紑鍙戝垎閰嶅崟鐙殑鍔熻兘鍒嗘敮鏉ヨ繘琛岀殑锛涜繖绉嶅伐浣滄祦鐨勪富骞插垎鏀粛鐒舵槸 master 鍒嗘敮锛屼絾鏄紑鍙戣€呭湪杩涜鏃ュ父闇€姹傚紑鍙戞椂涓嶈兘灏嗕唬鐮佺洿鎺ユ彁浜ゅ埌 master 鍒嗘敮涓婏紝涓€鑸槸涓虹壒瀹氱殑闇€姹傛柊寤轰竴涓姛鑳藉垎鏀紝骞朵笖鍙栦竴涓叿鏈夋弿杩版€х殑鍚嶅瓧锛屼緥濡傦細feat-personal-page銆乮ssue-#1702锛屾弿杩版€х殑鍚嶇О鍙互璁╁叾浠栧紑鍙戣€呭揩閫熷湴鏄庣櫧杩欎釜鍔熻兘鍒嗘敮鐨勪富瑕佷綔鐢紝鎻愰珮涓嶅悓寮€鍙戣€呬箣闂寸殑鍗忓悓鏁堢巼锛涘姛鑳藉垎鏀姛鑳芥祦鐨勬彁浜ゆ棩蹇楄褰曞鍥?3.1 鎵€绀猴細
浠庡浘涓彲浠ョ湅鍑猴紝鐩告瘮浜庨泦涓紡宸ヤ綔娴侊紝鍒嗘敮鍘嗗彶鐪嬭捣鏉ユ洿鍔犵畝娲併€佸悎鐞嗭紝璁╀笉鍚屽姛鑳界殑寮€鍙戣繘琛岄殧绂伙紝閬垮厤涓嶅悓鍔熻兘浠g爜涔嬮棿浜х敓涓嶅埄鐨勫奖鍝嶃€?/span>
姝ゅ锛屽湪鍔熻兘鍒嗘敮涓婄殑闇€姹傚紑鍙戝畬鎴愪箣鍚庯紝鎴戜滑闇€瑕佸皢鍒嗘敮鍚堝苟鍒颁富骞插垎鏀?master 涓婏紝杩欐椂鍊欓渶瑕佽繘琛岀殑鎿嶄綔鏄?pull request锛屼负浠€涔堣杩涜 PR 鎿嶄綔锛岃€屼笉鏄洿鎺ヨ繘琛屼唬鐮佺殑 merge 鍛紝杩欓噷棣栧厛闇€瑕佸ぇ瀹惰璇?PR 鏄粈涔堟搷浣滐紝鍏舵闇€瑕佸ぇ瀹朵簡瑙?PR 鎿嶄綔鐨勬剰涔夛紱
鍔熻兘闇€姹傚紑鍙戝畬鎴愪箣鍚庯紝闇€瑕佸皢鏈湴鍔熻兘鍒嗘敮鎺ㄩ€佸埌涓ぎ浠撳簱鐨勫姛鑳藉垎鏀笂锛岀劧鍚庡湪涓ぎ浠撳簱鐨勫姛鑳藉垎鏀笂鍙戣捣涓€涓?pull request 璇锋眰鍘诲皢鍔熻兘鍒嗘敮涓婄殑淇敼鍚堝苟鍒?master 鍒嗘敮涓婏紝杩欎釜杩囩▼涓€鑸槸鍦?GIT 鐨勯」鐩富椤典笂杩涜锛屽叕鍙稿唴閮ㄥ氨宸ヨ渹鐨勯」鐩富椤碉紝濡傚浘 3.2 鎵€绀猴紝鏄?flutter 椤圭洰鐨勬煇涓€娆?PR 璇︽儏锛?/span>
PR 鎿嶄綔缁欓」鐩甫鏉ョ殑鐩婂鏈変袱鐐癸細1銆乧ode review2銆佽璁轰唬鐮佺殑鍏叡骞冲彴
鍓嶈€呮槸姣忔 PR 鎿嶄綔鍙戠敓鏃朵細閫氱煡鐩稿叧鑰呮潵妫€鏌ュ緟鍚堝苟鐨勪唬鐮侊紝鍦ㄦ鏌ヨ繃绋嬩腑鍗冲畬鎴愪簡瀵逛唬鐮佺殑妫€瑙嗭紝杩欎釜杩囩▼淇濋殰浜?master 鍒嗘敮涓婄殑宸插悎骞朵唬鐮佺殑鍋ュ.鎬э紱鍚庤€呭垯鏄洜涓烘瘡娆?PR 閮戒細鏈変竴涓?PR 璇︽儏涓婚〉锛屽鍥?3.2锛屾瘡涓€涓紑鍙戣€呴兘鍙互閽堝浠g爜鐨勫疄鐜版彁鍑鸿嚜宸辩殑鎰忚锛屼娇寰楄璁轰唬鐮佸彉鎴愭洿鍔犱究鎹烽珮鏁堬紝涓斾负浠g爜鍙樻洿鍥為【鎻愪緵浜嗗彲鑳姐€?/span>
鍔熻兘鍒嗘敮宸ヤ綔娴佹槸 git 椤圭洰寮€鍙戦潪甯哥伒娲讳娇鐢ㄧ殑涓€绉嶆柟寮忥紝浣嗘槸瀵逛簬澶у瀷鐨勯」鐩€岃█锛岄渶瑕佷负涓嶅悓鐨勫垎鏀垎閰嶆洿鍔犲叿浣撶殑瑙掕壊銆?/span>
4.Gitflow 宸ヤ綔娴?/span>
Gitflow 宸ヤ綔娴佹槸鐩墠闈炲父鎴愮啛鐨勪竴涓柟妗堬紝瀹冨畾涔変簡涓€涓洿缁曢」鐩彂甯冪殑涓ユ牸鍒嗘敮妯″瀷锛岄€氳繃涓轰唬鐮佺爺鍙戙€侀」鐩彂甯冧互鍙婄淮鎶ゅ垎閰嶇嫭绔嬬殑鍒嗘敮鏉ヨ椤圭洰鐨勮凯浠h繃绋嬫洿鍔犲湴椤虹晠锛屼笉鍚屼簬涔嬪墠鐨勯泦涓紡宸ヤ綔娴佷互鍙婂姛鑳藉垎鏀伐浣滄祦锛実itflow 宸ヤ綔娴佸父椹荤殑鍒嗘敮鏈変袱涓細涓诲共鍒嗘敮 master銆佸紑鍙戝垎鏀?dev锛屾澶栭拡瀵归」鐩爺鍙戠殑鍚勪釜闃舵锛岃瀹氫簡鐗瑰畾鐨勫垎鏀€?/span>
闃舵鍒嗘敮甯搁┗ master銆乨ev 鐮斿彂 feature 鐑慨澶?hotfix 鍙戝竷 release
棣栧厛閽堝甯搁┗鍒嗘敮锛屽鍥?4.1
甯搁┗鍒嗘敮琛ㄧず鍦ㄩ」鐩彁浜ゅ巻鍙蹭腑涓€鐩村瓨鍦ㄧ殑鍒嗘敮锛岃繖閲?master 鍒嗘敮涓昏璺熻釜椤圭洰姝e紡鍙戝竷鐨勪唬鐮佸巻鍙诧紝dev 鍒嗘敮涓昏璺熻釜椤圭洰浠g爜鐮斿彂鐨勬彁浜ゅ巻鍙诧紱姝ゅ鍦?master 鍒嗘敮涓婇€氬父浼氫负鏌愭鐗堟湰鍙戝竷鍒嗛厤涓€涓爣绛炬潵璁板綍鐗堟湰鍙凤紝杩欎负浠ュ悗椤圭洰鎺掓煡瀹氫綅鎻愪緵渚垮埄銆?/span>
鎺ヤ笅鏉ワ紝鎴戜滑鏉ョ湅 gitflow 宸ヤ綔娴佷腑锛屼唬鐮佺爺鍙戦樁娈电殑宸ヤ綔娴佺▼銆?/span>
濡傚浘 4.2 鎵€绀猴紝寮€鍙戦樁娈靛紑鍚煇涓€涓渶姹傛椂闇€瑕佷粠 dev 鍒嗘敮涓婃柊寤哄姛鑳藉垎鏀?feature锛屽浘涓墍绀轰负涓や釜 feature 鍒嗘敮锛屼唬琛ㄥ悓鏃舵湁涓や釜鍔熻兘鍦ㄥ紑鍙戜腑锛岃繖閲岀殑 feature 鍒嗘敮浣跨敤璺熷姛鑳藉垎鏀伐浣滄祦涓殑浣跨敤鏂瑰紡鏄竴鏍风殑锛屽湪闇€姹傚紑鍙戝畬鎴愪箣鍚庨渶瑕佹彁浜?PR 璇锋眰鍚堝苟杩?dev 鍒嗘敮锛屽畬鎴愪箣鍚庡嵆鍙垹闄ゅ搴旂殑鍔熻兘鍒嗘敮銆?/span>
寰堝鏃跺€欙紝鍦ㄩ渶姹傜爺鍙戣繃绋嬩腑锛岀嚎涓婄殑浠g爜鍙兘浼氬嚭鐜伴棶棰橈紝杩欐椂鍊欓渶瑕佹垜浠繘琛屽強鏃剁殑淇锛岃繖灏辨槸椤圭洰杩唬杩囩▼涓殑鐑慨澶嶉樁娈点€?/span>
濡傚浘 4.3 鎵€绀猴紝鍋囪鎴戜滑鍦ㄥ紑鍙戠殑杩囩▼涓嚎涓婂嚭鐜颁簡涓€涓?bug锛岃繖鏃跺€欐垜浠渶瑕佷粠 master 鐨勬爣绛?v0.1 涓婃鍑轰竴浠藉垎鏀唬鐮?hotfix锛屼慨澶嶅苟楠岃瘉濂戒簡涔嬪悗锛岄渶瑕佸皢 hotfix 浠g爜鍒嗗埆鍚堝苟鍒?master /dev 鍒嗘敮涓婏紝骞跺湪 master 鐨勬彁浜や笂鎵撲笂涓€涓爣绛?v0.2锛岃繖閲岄渶瑕佸皢鐑慨澶嶇殑浠g爜鍒嗗埆鍚堝苟杩涗袱涓父椹诲垎鏀槸鍥犱负闇€瑕佷繚闅滀袱杈逛唬鐮佺殑涓€鑷存€с€?/span>
鏈€鍚庯紝鎴戜滑鏉ョ湅涓嬮」鐩凯浠g殑鍙戝竷闃舵锛屾垜浠渶瑕佸皢涔嬪墠鍔熻兘寮€鍙戝畬鎴愮殑鐗规€у彂甯冨埌绾夸笂鍘伙紝濡傚浘 4.4 鎵€绀?/span>
棣栧厛鍦?dev 鍒嗘敮鐨勬彁浜ゅ鏂板缓 release 鍒嗘敮锛屽湪杩欎釜鍒嗘敮涓婅繘琛?bug 淇銆侀潰鍚戝彂甯冪殑涓€浜涗换鍔★紝杩欎釜鍒嗘敮涓嶅仛浠讳綍鍔熻兘涓婄殑浠诲姟锛屽畬鎴愪箣鍚庡皢 release 鍒嗘敮鍐嶅垎鍒悎骞惰繘 master/dev 鍒嗘敮锛屽苟鍦?master 鎻愪氦涓婃墦涓婃爣绛?v1.0锛岃繖鏍蜂竴涓彂甯冮樁娈电殑浠g爜鎿嶄綔灏卞畬鎴愪簡
鏈€鍚庢垜浠潵鐪嬪彂甯冧箣鍚庣殑鐩墠鐨勬棩蹇楄褰曟儏鍐碉紝濡傚浘 4.5 鎵€绀猴紝杩欓噷鍙互灏嗘病鏈夌敤鐨勫垎鏀?hotfix銆乺elease銆乫eature 鍧囧垹闄や簡锛屽彲浠ョ湅鍑烘垜浠殑甯搁┗鍒嗘敮灏?master/dev锛屾渶涓嬮潰鐨?feature 琛ㄧず浠嶅湪寮€鍙戜腑銆?/span>
gitflow 宸ヤ綔娴佹槸鐩墠姣旇緝寰堟垚鐔熺殑鏂规锛屽畠鐨勪紭鐐规湁锛?/span>
1銆佸彂甯冭凯浠f祦绋嬫洿椤虹晠2銆佷娇寰椾唬鐮佹湁浜嗘洿鍔犱弗璋ㄧ殑椤圭洰缁撴瀯锛屾柟渚垮畾浣嶆帓鏌ラ棶棰?/span>
澶у瀷鐨勯」鐩?/ 杩唬閫熷害蹇殑鎺ㄨ崘浣跨敤杩欑宸ヤ綔娴佺▼锛?/span>
5.Forking 宸ヤ綔娴?/span>
鏈€鍚庝粙缁嶄竴绉嶅紑婧愰」鐩父鐢ㄧ殑宸ヤ綔娴?鈥斺€擣orking 宸ヤ綔娴侊紝浠嬬粛涔嬪墠棣栧厛闇€瑕佷簡瑙d粈涔堟槸 fork 鎿嶄綔锛屽鍥?5.1 鎵€绀?/span>
fork 鎿嶄綔鏄湪涓汉杩滅▼浠撳簱鏂板缓涓€浠界洰鏍囪繙绋嬩粨搴撶殑鎷疯礉锛屾搷浣滃緢绠€鍗曪紝姣斿 github 涓婂湪椤圭洰鐨勪富椤电偣鍑?fork 鎸夐挳鍗冲彲銆?/span>
鏄庣櫧浜?fork 鎿嶄綔涔嬪悗锛屾垜浠潵鐪嬩笅 forking 宸ヤ綔娴佺殑娴佺▼锛屽鍥?5.2 鎵€绀猴細
棣栧厛寮€鍙戣€?A 鎷ユ湁涓€涓繙绔粨搴擄紝杩欐椂鍊欐湁涓€涓紑鍙戣€?C 涔熸兂鍙備笌 A 鐨勮繖涓」鐩殑寮€鍙戝伐浣滐紝閭d粬灏卞彲浠?fork 涓€浠?A 鐨勮繖涓粨搴擄紝涔嬪悗鍦?c 鐨勪釜浜轰粨搴撻噷灏辨湁浜嗚繖浠戒唬鐮佸簱锛屽悗缁紑鍙戣€?C 灏卞彲浠ュ湪鑷繁鐨勮繖涓」鐩噷杩涜寮€鍙戝伐浣滐紝c 鍦ㄥ畬鎴愪簡鏌愪釜鍔熻兘鐨勫疄鐜颁箣鍚庯紝鍙互缁?A 鐨勪粨搴撳彂涓€涓?PR 璇锋眰锛岃繖鏃跺€欎細閫氱煡鍒板紑鍙戣€?A 鏈夋柊鐨?PR锛孉 濡傛灉鏈夐棶棰樺彲浠ョ洿鎺ュ湪杩欎釜 PR 閲屾彁锛屽紑鍙戣€?C 鍙互杩涜杩涗竴姝ョ殑淇敼锛屾渶鍚?A 閫氳繃浜?C 鐨勮繖浠?PR 璇锋眰锛屽氨浼氬皢 C 鐨勪唬鐮佸悎骞惰繘 A 鐨勪粨搴擄紝杩欐牱灏卞畬鎴愪簡 A / 浠g爜搴撴柊鐗规€х殑寮€鍙戙€傚悓鏃跺鏋滄湁鍏朵粬寮€鍙戣€呭 A 鐨勯」鐩湁鍏磋叮涔熶細杩涜鐩稿悓鐨勬搷浣溿€?/span>
杩欓噷娉ㄦ剰鍒?寮€鍙戣€?B/C 骞朵笉鏄?A 浠g爜搴撶殑寮€鍙戜汉鍛橈紝鑰屾槸绗笁鏂瑰紑鍙戣€咃紝鎵€浠ヨ繖绉嶅伐浣滄祦涓昏鐢ㄤ簬寮€婧愰」鐩紒
6. 鎬荤粨
鏈€鍚庡洖椤句笅杩欏嚑绉?git 宸ヤ綔娴侊紝闆嗕腑寮忓伐浣滄祦鍙互璇存槸 git 宸ヤ綔娴佺殑鍩虹锛屽垵瀛﹁€呭彲浠ユ棤缂濆湴浠?svn 鐨勬ā寮忓垏鎹㈠埌 git 鐨勬ā寮忥紱鍔熻兘鍒嗘敮宸ヤ綔娴佸湪闆嗕腑寮忕殑鍩虹涓婂張寮曞叆浜嗗姛鑳藉垎鏀紝鐏垫椿鍦板埄鐢ㄤ簡 git 鐨勫垎鏀壒鎬э紝鍔熻兘鍒嗙 / PR 浼樺寲浜嗘棩甯稿伐浣滅殑鏁堢巼锛沢itflow 宸ヤ綔娴佸垯鏄负澶у瀷椤圭洰鐨勮凯浠h繃绋嬫湇鍔$殑锛屾寚瀹氫簡涓€涓弗鏍肩殑鍒嗘敮妯″瀷锛屼娇寰楄凯浠f祦绋嬫洿鍔犻『鐣咃紱forking 宸ヤ綔娴佸垯鏄紑婧愰」鐩殑棣栭€夛紝鎯宠涓哄紑婧愰」鐩仛璐$尞灏卞繀椤昏鎳傚緱杩欑宸ヤ綔娴侊紒
褰撶劧锛屼互涓婃弿杩扮殑杩欎簺宸ヤ綔娴佸苟涓嶆槸瀹為檯宸ヤ綔涓?git 浣跨敤鐨勫噯鍒欙紝杩欏彧鏄竴浜涙帹鑽愮殑浣跨敤鏂瑰紡锛屽湪鍏蜂綋鐨勯」鐩爺鍙戣繃绋嬩腑锛屾垜浠渶瑕佺粨鍚堥」鐩互鍙婂洟闃熺幇鐘朵綔鍑哄彇鑸嶏紝鎬荤粨鍑洪€傚悎鑷繁鍥㈤槦鐨勫伐浣滄祦锛屾墠鑳借 git 鏇村ソ鍦颁负鎴戜滑鏈嶅姟锛?/span>
以上是关于涓嶇啛缁?Git 琚紭鍖栦簡锛佽吘璁槸濡備綍浣跨敤 Git 鐨?锛?/h1>