浣犱笉鐭ラ亾鐨凣it
Posted 鍓嶇浜?/a> 浣犱笉鐭ラ
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了浣犱笉鐭ラ亾鐨凣it相关的知识,希望对你有一定的参考价值。
鍘熸枃锛歫uejin.cn/post/6931977429732818952
娣诲姞鏃犲箍鍛婁紭璐ㄥ涔犵兢
鍓嶈█
鐩镐俊澶у宸茬粡鐗瑰埆鐔熺粌浜唃it鐨勪娇鐢紝宸茬粡瓒冲婊¤冻鏃ュ父寮€鍙戜簡銆傚鏋滆繕鏈変汉涓嶄細浣跨敤git鐨勫幓鐪嬪粬闆嘲澶х鐨刧it鏁欑▼锛堥浂鍩虹鏁欏锛夋弧瓒虫棩甯稿紑鍙戠殑鍚屾椂锛屾垜浠彲鑳戒篃浼氶亣鍒板濂囨€€殑闂馃槪锛屾垜灏辨妸鎴戦亣鍒扮殑闂锛屼互鍙婁娇鐢℅it鐨勫皬鎶€宸у垎浜竴涓嬸煣点€?/p>
git pull 鎻愮ず閿欒,Your local changes to the following files would be overwritten by merge
鍦烘櫙鍐嶇幇锛?span class="mq-16">
鑰佹潕馃憯鍜岃€佸紶馃Д鍚屾椂寮€鍙戜竴涓」鐩紝浠栦滑涓や釜寮€鍙戠殑宸ヤ綔鏈変氦鍙夛紝鑰佹潕鍐欎唬鐮侀潪甯稿揩锛屾病涓嬬彮灏辩伀鎬ョ伀鐕庣殑鍐欏畬浜嗭紝鑰佸紶姣旇緝鎱㈠揩鍒颁笅鐝殑鏃跺€欐墠鎶婁唬鐮佸啓瀹岎煒掋€傝繖鏃跺綋浠栨兂鏇存柊浠g爜,鑰佹潕璇存垜鏇存柊浠g爜浜嗕綘鍏坧ull涓€涓嬶紝浜庢槸灏变骇鐢熶簡涓婇潰鐨勯棶棰橈紒锛侊紒
浜х敓鍘熷洜锛?span class="mq-20">
澶氫汉鎿嶄綔鍦烘櫙锛屽叾涓竴浜哄皢浠g爜鎻愪氦鍒拌繙绋媑it,鍙︿竴涓汉涔熶慨鏀逛簡鏂囦欢鍑嗗pull鐨勬椂鍊欎細浜х敓璇ラ棶棰橈紱
瑙e喅鏂规涓€:
淇濈暀鏈湴鏂颁慨鏀圭殑浠g爜銆傛殏瀛樻湰鍦版柊淇敼浠g爜锛屽苟鎶奼it鏈嶅姟鍣ㄤ笂鐨勪唬鐮乸ull鍒版湰鍦帮紝閲婃斁鏆傚瓨 涔嬪悗鎸夌収 add commit push 杩涜浠g爜鏇存柊銆?/p>
git stash
git pull origin master
git stash pop
瑙e喅鏂规浜?
瑕嗙洊鏈湴鏂颁慨鏀圭殑浠g爜锛屽彧淇濈暀鏈嶅姟绔殑浠g爜銆傜洿鎺ラ€€鍥炲埌涓婁竴涓増鏈劧鍚庢妸git鏈嶅姟鍣ㄤ笂鐨勪唬鐮乸ull鍒版湰鍦?/p>
git reset --hard
git pull origin master
.gitignore 鏃犳晥鐨勮В鍐虫柟娉?span class="mq-36">
鍦烘櫙鍐嶇幇: .gitignore绗竴娆℃病鏈夊啓鍏ㄣ€傛瘮濡傝€佹潕鏂板缓浜嗕竴涓」鐩窡寰€甯镐竴鏍锋甯哥殑鎻愪氦锛岄殢鐫€椤圭洰浣撶Н鐨勪笉鏂鍔狅紝鑰佹潕鍙戠幇鏈変竴涓枃浠剁殑鐩綍涓婁紶鐨刧it鏍规湰鏄病鏈夊繀瑕佺殑锛岃繕鐗瑰埆澶с€備簬鏄€佹潕灏卞湪.gitignore涓姞鍏ヤ簡鍝嶅簲鐨勭洰褰曡鍒欙紝浣嗘槸骞舵病鏈夌敓鏁堬紒锛侊紒
浜х敓鍘熷洜锛?span class="mq-40">
.gitignore鍙兘蹇界暐閭d簺鍘熸潵娌℃湁琚玹rack鐨勬枃浠讹紝濡傛灉鏌愪簺鏂囦欢宸茬粡琚撼鍏ヤ簡鐗堟湰绠$悊涓紝鍒欎慨鏀?gitignore鏄棤鏁堢殑
瑙e喅鍔炴硶锛?span class="mq-44">
鍏堟妸鏈湴缂撳瓨鍒犻櫎锛岀劧鍚庡啀鎻愪氦銆?/p>
git rm -r --cached .
git add .
git commit -m 'niubi'
git push -u origin master(-u鍙傛暟鐨勬剰涔?
涓嶅甫浠讳綍鍙傛暟鐨刧it push锛岄粯璁ゅ彧鎺ㄩ€佸綋鍓嶅垎鏀?/p>
git push -u origin master
涓婇潰鍛戒护灏嗘湰鍦扮殑master鍒嗘敮鎺ㄩ€佸埌origin涓绘満锛屽悓鏃舵寚瀹歰rigin涓洪粯璁や富鏈猴紝鍚庨潰灏卞彲浠ヤ笉鍔犱换浣曞弬鏁颁娇鐢╣it push浜嗐€?/p>
git push 濡傛灉褰撳墠鍒嗘敮涓庡涓富鏈哄瓨鍦ㄨ拷韪叧绯伙紝閭d箞杩欎釜鏃跺€欎篃鍙互浣跨敤-u閫夐」浼氭寚瀹氫竴涓粯璁や富鏈猴紝濡傛灉涓嶅姞鍙傛暟灏变細鎺ㄩ€佸埌榛樿涓绘満(鍦烘櫙锛氬悓涓€涓」鐩鍏宠仈浜唃ithub涔熷叧鑱斾簡gitee)銆?/p>
涓€涓」鐩叧鑱斿涓繙绋婫it浠撳簱
鏂规硶涓€:
浣跨敤 git remote add 鍛戒护
git remote add github https://github.com/xxx/xxx.git #鍏宠仈github
git remote add gitee https://gitee.com/xxx/xxx.git # 鍏宠仈gitee
缂虹偣: 姣忔push鐨勬椂鍊欓兘瑕乸ush涓ゆ鎵嶈兘鎺ㄩ€佸埌鍝嶅簲鐨勮繙绋嬨€?/p>
git push github master
git push gitee master
鏂规硶浜岋細
浣跨敤 git remote set-url 鍛戒护
鍓嶆彁鏄綘宸茬粡鏈変簡涓€涓繙绋嬪簱浜嗭紝鍐嶆娣诲姞鍙︿竴涓繙绋嬪簱銆?/p>
git remote set-url --add github https://git.oschina.net/zxbetter/test.git
杩欐牱鍙鎵цgit push github master涓€娆″氨鍙互鎺ㄩ€佸埌涓や釜杩滅▼搴撲簡銆?br>git push鍒拌繙绋嬫寚瀹氬垎鏀?br>
瑙e喅鏂规涓€
鍏堝垱寤鸿繙绋嬪垎鏀?/p>
git push <杩滅▼涓绘満鍚?gt; <鏈湴鍒嗘敮鍚?gt;:<杩滅▼鍒嗘敮鍚?gt;
瑙e喅鏂规浜?span class="mq-85">
鍏堝垱寤烘湰鍦板垎鏀苟鍒囨崲鍒拌鍒嗘敮,push鐨勬椂鍊欏彲浠ョ洿鎺ユ寚瀹氳繙绋嬪垎鏀悕锛岃繙绋嬪垎鏀細鑷姩鍒涘缓銆?/p>
git checkout -b [鏈湴鍒嗘敮鍚峕
git add .
git commit -m
git push origin [杩滅▼鍒嗘敮鍚峕
git 缁欏垎鏀坊鍔犳弿杩?span class="mq-91">
鍦烘櫙鍐嶇幇锛?span class="mq-94">
鑰佸紶馃懆鈥嶐煉诲湪寮€鍙戦」鐩殑杩囩▼涓粡甯告湁涓嶅悓鐨勯渶姹傦紝娌℃湁鍔炴硶浠栧彧鑳藉缓绔嬩笉鍚岀殑鍒嗘敮鏉ョ淮鎶よ嚜宸辩殑椤圭洰銆傜ǔ瀹氳繍琛屼竴涓湀涔嬪悗锛岀獊鐒舵湁涓€涓湴鍔跨殑椤圭洰瑕佹敼闇€姹傦紝浠栧凡缁忓繕璁颁簡褰撴椂寤虹珛鐨勫垎鏀槸骞蹭粈涔堢殑浜嗗涓嬪浘銆傚綋鏃舵毚鎬掞紝鎻愬嚭绂昏亴馃槻銆?/p>
瑙e喅鍔炴硶涓€
浣跨敤鍛戒护缁欏垎鏀坊鍔犳弿杩?/p>
git config branch.[branch_name].description "鍒嗘敮鎻忚堪淇℃伅" # 璁剧疆鍒嗘敮鎻忚堪
git config branch.{branch_name}.description # 鑾峰彇鍒嗘敮鎻忚堪
杩欐牱鐨勭己鐐瑰お鏄庢樉浜嗘瘡娆″彧鑳借幏鍙栦竴涓垎鏀殑鎻忚堪锛屽懡浠よ繕鐗瑰埆闀裤€?/p>
瑙e喅鍔炴硶浜?span class="mq-110">
浣跨敤npm鍖単it-br
$ npm install -g git-br # 鍏ㄥ眬瀹夎git-br
$ git config branch.[branch_name].description "鍒嗘敮鎻忚堪淇℃伅" # 璁剧疆鍒嗘敮鎻忚堪
$ git br # 鑾峰彇鍒嗘敮鎻忚堪
Git鎿嶄綔澶辫触骞舵彁绀篈nother git process seems to be running
鍘熷洜锛?span class="mq-121">
Git鍦ㄤ娇鐢ㄨ繃绋嬩腑閬亣浜嗗婧冿紝閮ㄥ垎琚笂閿佽祫婧愭病鏈夎閲婃斁瀵艰嚧鐨?/p>
瑙e喅鏂规锛?span class="mq-125">
杩涘叆椤圭洰鏂囦欢澶逛笅鐨?.git鏂囦欢涓紙鏄剧ず闅愯棌鏂囦欢澶规垨rm .git/index.lock锛夊垹闄ndex.lock鏂囦欢鍗冲彲銆傚垱寤哄共鍑€鐨勬湰鍦板垎鏀苟鍏宠仈杩滅▼鍒嗘敮銆?/p>
涓€鑸湪涓€涓垎鏀笅鍒涘缓鏂扮殑鍒嗘敮鏃讹紝浼氭妸涓婁釜鍒嗘敮鐨勫唴瀹瑰鍒跺埌鏂板垎鏀腑锛屽鏋滄垜浠笉鎯宠涓婁釜鍒嗘敮鐨勫唴瀹癸紝鍒涘缓骞插噣鐨勫垎鏀紝鏀规€庝箞鍔炲憿锛?/p>
瑙e喅鏂规
git checkout -b 鏈湴鍒嗘敮鍚?nbsp; origin/杩滅▼鍒嗘敮鍚?br>
Git鎻愪氦甯﹁〃鎯咅煄?span class="mq-135">
杩欑鎻愪氦鎴戜滑鍦╣ithub涓婂緢甯歌锛屼粬浠槸鎬庝箞鎶婅〃鎯呭姞涓婂幓鐨勫憿
鍏ㄥ眬瀹夎 gitmoji-cli
npm i -g gitmoji-cli
瀹夎瀹屼箣鍚庡彧闇€瑕佸湪姣忔鎻愪氦鐨勬椂鍊欏姞涓婄浉搴旂殑琛ㄦ儏缂栫爜灏卞彲浠ヤ簡锛屼笉鍚岀殑琛ㄦ儏浠h〃鐫€涓嶅悓鐨勭被鍒紝浣垮緱浠g爜鎻愪氦鏇村姞娓呮櫚銆俫itmoji
涓句釜鏍楀瓙馃Ж
鍙戠幇鎴戠殑鎻愪氦鍓嶉潰宸茬粡鏈夊皬琛ㄦ儏浜嗘槸涓嶆槸闈炲父鏄庢樉馃憖銆?/p>
Git鎻愪氦瑙勮寖 搴熻瘽灏戣鍏堜笂鍥攫煠?/p>
浣犳槸涓嶆槸涔熶竴鑴告嚨閫硷紝杩欐槸鍦ㄦ彁浜や粈涔堛€備竴鑸潵璇碿ommit搴旇涓€鐪煎氨鑳界煡閬撴彁浜ょ殑鏄粈涔堛€備篃涓轰簡鍜屼竴璧峰紑鍙戠殑鍚屼簨娓呮鐨勭煡閬擄紝浣犺繖娆℃彁浜ょ殑鍐呭馃檮銆傜綉涓婂ぇ閮ㄥ垎璇寸殑瑙勮寖灏辨槸Angular 瑙勮寖鑻辨枃濂界殑鍚屽鍙互鍘荤湅鐪嬶紝涔熷彲浠ョ洿鎺ュ弬鑰冮槷涓€宄板ぇ浣殑鍗氬浜嗚В浜嗗ぇ姒傝鑼冧箣鍚庢垜浠氨鎵惧搷搴旂殑宸ュ叿甯垜浠紕鎴愯鑼冪殑鏍峰瓙灏卞ソ鍟︷煒併€侰ommitizen锛堝悎鏍糃ommit message 鐨勫伐鍏凤級 鍏ㄥ眬瀹夎
npm install -g commitizen
鐒跺悗锛屽湪椤圭洰鐩綍閲岋紝杩愯涓嬮潰鐨勫懡浠わ紝浣垮叾鏀寔 Angular 鐨?Commit message 鏍煎紡銆?/p>
commitizen init cz-conventional-changelog --save --save-exact
娉ㄦ剰锛氬洜涓篶ommitizen宸ュ叿鏄熀浜嶯ode.js鐨?鎵€浠ヨ淇濊瘉浣犵殑椤圭洰涓嬭鏈塸ackage.
涔嬪悗鍐嶆彁浜や唬鐮佺殑鏃跺€欎娇鐢╣it cz 浠f浛git commit鍛戒护灏变細鍑虹幇鎻愪氦绫诲瀷鐨勯€夋嫨锛屼娇浣犳彁浜ょ殑浠g爜鏇磋鑼冦€傪煠?/p>
cz-customizable 鑷畾涔変腑鏂囬厤缃?浣犵殑閫夋嫨绫诲埆鍙兘鏄嫳鏂囷紝杞崲鎴愪腑鏂囦篃鐗瑰埆绠€鍗?鍦ㄩ」鐩腑杩愯濡備笅鍛戒护
npm install cz-customizable --save-dev
commitizen init cz-customizable --save-dev --save-exact --force
淇敼package.json 涓?config.commitizen 瀛楁涓?/p>
"config": {
"commitizen": {
"path": "./node_modules/cz-customizable"
}
}
鍦ㄩ」鐩牴鐩綍鍒涘缓涓€涓?.cz-config.js 鐨勬枃浠惰繖涓枃浠剁殑鍐呭鎴戜滑鍙傜収澶т浆鍐欏ソ鐨勫氨琛屼簡 鍏抽棴鍛戒护绐楀彛鍐嶆鎵撳紑杈撳叆git cz灏变細鍙戠幇宸茬粡鍏ㄩ儴鍙樻垚涓枃鍟?澶у姛鍛婃垚馃帹銆?/p>
鎬荤粨
杩欏氨鏄垜鍦ㄥ紑鍙戜腑閬囧埌杩囩殑涓€浜涘父瑙侀棶棰橈紝浠ュ悗濡傛灉鏈夋柊鐨勯棶棰橈紝杩樹細鎸佺画鏇存柊鍝掞紝濡傛灉鎴戠殑鏂囩珷瀵逛綘鏈夌敤锛岃寰椾笁杩炰竴涓嬪摝
-
鍥炲 璧勬枡鍖?/code>棰嗗彇鎴戞暣鐞嗙殑杩涢樁璧勬枡鍖?
-
鍥炲 鍔犵兢
锛屽姞鍏ュ墠绔繘闃剁兢 -
console.log("鏂?/span>绔?/span>鐐硅禐===鏂?/span>绔?/span>鐐?/span>鍦?/span>鐪?==浣犳垜閮?/span>蹇箰"
-
Bug绂绘垜鏇磋繙浜嗭紝蹇箰绂绘垜鏇磋繎浜?
以上是关于浣犱笉鐭ラ亾鐨凣it的主要内容,如果未能解决你的问题,请参考以下文章