Git鍒嗘敮浣跨敤
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Git鍒嗘敮浣跨敤相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e9%9c%80%e8%a6%81' title='闇€瑕?>闇€瑕?/a> his ict origin 杩滅▼鍒嗘敮 閫氳繃 track git add orm
鍒涘缓鍒嗘敮
easy:
git checkout -b my-test //鍦ㄥ綋鍓嶅垎鏀笅鍒涘缓my-test鐨勬湰鍦板垎鏀垎鏀?git push origin my-test //灏唌y-test鍒嗘敮鎺ㄩ€佸埌杩滅▼
git branch --set-upstream-to=origin/my-test //灏嗘湰鍦板垎鏀痬y-test鍏宠仈鍒拌繙绋嬪垎鏀痬y-test涓?
git branch -a //鏌ョ湅杩滅▼鍒嗘敮
0.鍙互閫氳繃git branch -r 鍛戒护鏌ョ湅杩滅搴撶殑鍒嗘敮鎯呭喌
1.浠庡凡鏈夌殑鍒嗘敮鍒涘缓鏂扮殑鍒嗘敮(濡備粠master鍒嗘敮),鍒涘缓涓€涓猟ev鍒嗘敮
git checkout -b dev
2.鎻愪氦璇ュ垎鏀埌杩滅▼浠撳簱
git push origin dev
鏂板缓鏈湴鍒嗘敮鍚庡皢鏈湴鍒嗘敮鎺ㄩ€佸埌杩滅▼搴? 浣跨敤git pull 鎴栬€?git push 鐨勬椂鍊欐姤閿?/p>
gitThere is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> merged0.9.6
鏄洜涓烘湰鍦板垎鏀拰杩滅▼鍒嗘敮娌℃湁寤虹珛鑱旂郴 (浣跨敤git branch -vv 鍙互鏌ョ湅鏈湴鍒嗘敮鍜岃繙绋嬪垎鏀殑鍏宠仈鍏崇郴) .鏍规嵁鍛戒护琛屾彁绀哄彧闇€瑕佹墽琛屼互涓嬪懡浠ゅ嵆鍙?br>
git branch --set-upstream-to=origin/杩滅▼鍒嗘敮鐨勫悕瀛?鏈湴鍒嗘敮鐨勫悕瀛?/p>
git log --name-status 姣忔淇敼鐨勬枃浠跺垪琛? 鏄剧ず鐘舵€?/p>
git branch --merged 鏌ョ湅鍝簺鍒嗘敮宸茶骞跺叆褰撳墠鍒嗘敮
鍒犻櫎鍒嗘敮
鏌ョ湅椤圭洰鐨勫垎鏀滑(鍖呮嫭鏈湴鍜岃繙绋?
鍛戒护琛?: $ git branch -a
鍒犻櫎鏈湴鍒嗘敮
鍛戒护琛?: $ git branch -d <BranchName>
鍒犻櫎杩滅▼鍒嗘敮
鍛戒护琛?: $ git push origin --delete <BranchName>
鏌ョ湅鍒犻櫎鍚庡垎鏀滑
鍛戒护琛?: $ git branch -a
git remote prune origin 娓呯悊杩滅▼鍒嗘敮锛屾妸鏈湴涓嶅瓨鍦ㄧ殑杩滅▼鍒嗘敮鍒犻櫎
鏌ョ湅鍒嗘敮
- git branch -a
鍒囨崲鍒嗘敮
姣斿鍚屾椂鏈変笁涓汉寮€鍙戯紝1.2鏈€鏃╂槸鍩轰簬1.0锛屼絾鏄敱浜庨」鐩湭鍙戝竷锛?.0,1.1,1.2鍏ㄩ儴閮藉湪鍚屾椂寮€鍙戯紝鐜板湪鎯虫妸1.0宸茬粡澧炲姞鐨勫姛鑳藉厛鍚堝苟鍒?.2锛?br />
dev beta
1.0 1.2
姝ゆ椂鐨勬楠わ細check 1.2鍜?.0
git checkout v1.0
git checkout v1.2
鐒跺悗鍐峷1.2鐨勫垎鏀熀纭€涓婃墽琛宮erge
git merge v1.0
姣斿鍚屾椂鏈変笁涓汉寮€鍙戯紝1.2鏈€鏃╂槸鍩轰簬1.0锛屼絾鏄敱浜庨」鐩湭鍙戝竷锛?.0,1.1,1.2鍏ㄩ儴閮藉湪鍚屾椂寮€鍙戯紝鐜板湪鎯虫妸1.0宸茬粡澧炲姞鐨勫姛鑳藉厛鍚堝苟鍒?.2锛?br />
dev beta
1.0 1.2
姝ゆ椂鐨勬楠わ細check 1.2鍜?.0
git checkout v1.0
git checkout v1.2
鐒跺悗鍐峷1.2鐨勫垎鏀熀纭€涓婃墽琛宮erge
git merge v1.0
濡傛灉娌℃湁鎶ラ敊锛岄偅灏辩洿鎺ユ彁浜や唬鐮?em style="color:#c7254e">git push origin v1.2
濡傛灉鎶ラ敊锛屽熀鏈槸鍐茬獊浜?姣斿)锛?br />
CONFLICT (content): Merge conflict in app/src/main/androidManifest.xml
Auto-merging app/build.gradle
CONFLICT (content): Merge conflict in app/build.gradle
Automatic merge failed; fix conflicts and then commit the result.
浣犻渶瑕佸幓鍒版彁绀虹殑鏂囦欢閲屾妸git鑷姩鏍囨敞鐨勭増鏈啿绐佹敞閲婃帀锛岀湅浣犲叿浣撻渶瑕佺殑鍔熻兘杩涜鍒犲噺
鐒跺悗鎶婂啿绐佺殑鏂囦欢git add锛屽拰commit锛屾瘮濡備綘鏈?涓啿绐佹枃浠讹紝澶氭枃浠禷dd鐨勬椂鍊欑洿鎺ョ┖鏍奸殧寮€
git add app/src/main/AndroidManifest.xml app/build.gradle
鏈€鍚庡啀commit
git commit -m "瑙e喅2涓垎鏀箣闂寸殑鍐茬獊"
鎻愪氦浠g爜
git push origin v1.2
鎼炲畾
Git鍥為€€鐗堟湰
git reset --hard 鐗堟湰id
git push -f鎻愪氦浼氭妸鍥為€€鐗堟湰涔嬪悗鐨勮褰曞垹闄?/code>