git 团队协作的一些命令

2018-7-10 雨辰 遇到的一些问题

总结了下git常用命令

  • 1.开分支

    git branch 新分支名
    例如,在master分支下,新开一个开发分支: git branch dev
  • 2.切换到新分支

    git checkout 分支名
    例如,在master分支下,切换到新开的dev: git checkout dev
  • 3.开分支和切换分支合并到一个命令

    git checkout -b 新分支名
    例如,新开一个开发分支,并立即切换到该分支: git checkout -b dev
  • 4.切换回原分支

    git checkout 原分支名
    例如,切换回master git checkout master
    注意:当前分支有修改,还未commit的时候,会切换失败,应当先commit,但可以不用push
  • 5.合并分支

    git merge 需要合并的分支名
    例如,刚刚已经切换回master,现在需要合并dev的内容: git merge dev
    建议在GitLab(或者其他git系统)上面创建merge request的形式来进行分支的合并和代码审核。
  • 6.查看本地分支列表

    git branch -a 前面带remotes/origin 的,是远程分支
  • 7.查看远程分支列表

    git branch -r
  • 8.向远程提交本地新开的分支

    git push origin 新分支名
    例如,刚刚在master下新开的dev分支: git push origin dev
  • 9.删除远程分支

    git push origin :远程分支名
    例如,删除刚刚提交到远程的dev分支: git push origin :dev
  • 10.删除本地分支

    git branch 分支名称 -d 例如,在master分支下,删除新开的dev分支: git branch dev -d 注意:如果dev的更改,push到远程,在GitLab(或者其他git系统)上面进行了merge操作,但是本地master没有pull最新的代码,会删除不成功,可以先git pull origin master,或者强制删除 git branch dev -D
  • 11.更新分支列表信息

    git fetch -p
  • 12.TortoiseGit(乌龟git)

    不可否认,在windows下,这个是个不错的工具。不管你是命令行新手还是重度使用者,我觉得都可以尝试一下。

标签: 技术问题

评论:

moobicent
2021-06-02 21:26
<a href="https://www.ballinwillin.com/baltimore-ravens-jersey-black-jerseyc">baltimore ravens jersey black</a> <a href="https://www.frykleaner.com/rfid-tote-torebki-torebkid">rfid tote torebki</a> <a href="https://www.tobiconnors.com/s8-case-wallet-casec">s8 case wallet</a> <a href="https://www.actiocloud.com/trendy-college-tassen-for-girl-tassenb">trendy college tassen for girl</a> <a href="https://www.igbguides.com/moto-z2-play-phone-pouzdro-pouzdroe">moto z2 play phone pouzdro</a> <a href="https://www.goisealcoat.com/bcbg-zelen%C3%A1-sweater-%C5%A1aty-satyc">bcbg zelen谩 sweater 拧aty</a>
moobicent https://www.moobicent.com/
wikistrea
2021-05-29 01:44
<a href="https://www.gotosubic.com/xperia-phone-cases-casec">xperia phone cases</a> <a href="https://www.antakyahotel.com/cath-kidston-boys-rugzak-tassenb">cath kidston boys rugzak</a> <a href="https://www.appsnuage.com/samsung-galaxy-j7-sky-pro-clear-pouzdro-pouzdroe">samsung galaxy j7 sky pro clear pouzdro</a> <a href="https://www.anamyth.com/bandeau-pencil-%C5%A1aty-satyc">bandeau pencil 拧aty</a> <a href="https://www.gorgianhomes.com/awesome-snapback-cappelli-cappelloa">awesome snapback cappelli</a> <a href="https://www.mozsteel.com/bloch-girls-tap-shoes-bootsa">bloch girls tap shoes</a>
wikistrea https://www.wikistrea.com/
bursaaudio
2021-05-27 10:03
<a href="http://www.nicolezangara.com/roots-canada-leder-taschen-tasched">roots canada leder taschen</a> <a href="http://www.jvbowl.com/pantaloni-puma-larghi-tutab">pantaloni puma larghi</a> <a href="http://www.dchamberlin.com/violet-suede-jordan-11-chaussures1">violet suede jordan 11</a> <a href="http://www.altaimplement.com/todas-rojo-air-max-vapormax-plus-zapatos1">todas rojo air max vapormax plus</a> <a href="http://www.laukemperauto.com/custom-made-ball-berretto-cappellod">custom made ball berretto</a> <a href="http://www.autofusionny.com/air-max-95-se-fekete-feh%C3%A9r-sneaker5">air max 95 se fekete feh茅r</a>
bursaaudio http://www.bursaaudio.com/
soyezriche
2021-05-24 05:52
<a href="https://www.dalezeskind.com/ocean-pacific-mens-flip-flops-bootsa">ocean pacific mens flip flops</a> <a href="https://www.cetdomain.com/schwarz-und-wei%C3%9F-nicht-gerade-weiss-schuhe-stiefeld">schwarz und wei脽 nicht gerade weiss schuhe</a> <a href="https://www.ibmwsc.com/stylish-iphone-xr-hoesje-hoesjea">stylish iphone xr hoesje</a> <a href="https://www.winzuk.com/plain-basketball-jerseys-near-me-jerseyc">plain basketball jerseys near me</a> <a href="https://www.physalisfruit.com/beauty-bee-diaper-torba-torebkid">beauty bee diaper torba</a> <a href="https://www.pangsuankaew.com/samsung-s10-plus-clear-cover-casec">samsung s10 plus clear cover</a>
soyezriche https://www.soyezriche.com/
wlpappraisal
2021-05-21 17:11
<a href="http://www.salonjive.com/cute-iphone-7-cases-for-girls-casec">cute iphone 7 cases for girls</a> <a href="http://www.viewdenali.com/supreme-3m-reflective-repeat-rugzak-wit-tassena">supreme 3m reflective repeat rugzak wit</a> <a href="http://www.kyleshadix.com/note-9-pouzdro-with-holster-pouzdrod">note 9 pouzdro with holster</a> <a href="http://www.oasouth.com/lace-button-back-wedding-%C5%A1aty-satyb">lace button back wedding 拧aty</a> <a href="http://www.drtoddrussell.com/milwaukee-brewers-under-armour-mlb-driver-berretto-cappelloa">milwaukee brewers under armour mlb driver berretto</a> <a href="http://www.gleeshabbat.com/ladies-block-heel-ankle-boots-bootsa">ladies block heel ankle boots</a>
wlpappraisal http://www.wlpappraisal.com/
cambridgeauto
2021-05-16 06:37
<a href="http://www.yorkjobs.net/dak-prescott-embroidered-jersey-jerseyc">dak prescott embroidered jersey</a> <a href="http://www.paytonppie.net/dunhill-torba-torebkid">dunhill torba</a> <a href="http://www.seedac.net/phone-case-for-oppo-a83-casec">phone case for oppo a83</a> <a href="http://www.uwhuwelijk.net/personalized-duffle-tassen-for-sports-tassenb">personalized duffle tassen for sports</a> <a href="http://www.biggirlbaking.net/zero-gravity-cell-phone-pouzdro-pouzdroe">zero gravity cell phone pouzdro</a> <a href="http://www.martion.net/ruffle-front-%C5%A1aty-satyc">ruffle front 拧aty</a>
cambridgeauto http://www.cambridgeauto.net/
ahamanhattan
2021-05-05 15:25
<a href="http://www.yorkjobs.net/golden-state-warriors-st.-patricks-day-9twenty-berretto-cappelloa">golden state warriors st. patricks day 9twenty berretto</a> <a href="http://www.paytonppie.net/comfy-platform-shoes-bootsa">comfy platform shoes</a> <a href="http://www.seedac.net/lacoste-schuhe-f%C3%BCr-m%C3%A4nner-stiefeld">lacoste schuhe f眉r m盲nner</a> <a href="http://www.uwhuwelijk.net/element-hoesje-s10-hoesjea">element hoesje s10</a> <a href="http://www.biggirlbaking.net/ajax-9-huntelaar-home-long-sleeves-soccer-club-jersey-jerseyc">ajax 9 huntelaar home long sleeves soccer club jersey</a> <a href="http://www.martion.net/forever-21-sk%C3%B3rzany-plecak-torebkid">forever 21 sk贸rzany plecak</a>
ahamanhattan http://www.ahamanhattan.net/
ajpaircon
2021-05-01 05:40
<a href="http://www.nicolezangara.com/air-max-97-naranja-y-negro-zapatos1">air max 97 naranja y negro</a> <a href="http://www.jvbowl.com/gmc-ball-berretto-cappellod">gmc ball berretto</a> <a href="http://www.dchamberlin.com/new-balance-574-sport-barna-sneaker5">new balance 574 sport barna</a> <a href="http://www.altaimplement.com/christmas-jumper-ruha-2018-ruhakb">christmas jumper ruha 2018</a> <a href="http://www.laukemperauto.com/noir-39thirty-chapeau-chapeauc">noir 39thirty chapeau</a> <a href="http://www.autofusionny.com/loopy-blossom-sag-saga">loopy blossom sag</a>
ajpaircon http://www.ajpaircon.com/
chrisklaiber
2021-04-30 12:28
<a href="http://us.machinecocks.com/tools-home-improvement-horizontal-vertical-lasers-amc">tools home improvement horizontal vertical lasers</a> <a href="http://us.mamcoa.com/bady-solid-feeding-utensils-ama">bady solid feeding utensils</a> <a href="http://us.gothosband.com/industrial-scientific-spade-ama">industrial scientific spade</a> <a href="http://us.mewallacelaw.com/tools-home-improvement-stepstools-4-ame">tools home improvement stepstools 4</a> <a href="http://us.danarosas.com/luggage-tags-2-amd">luggage tags 2</a> <a href="http://us.sharpsmilspec.com/home-kitchen-rice-cookers-1-ama">home kitchen rice cookers 1</a>
[url=http://us.chrisklaiber.com/]chrisklaiber[/url]
flatbedinkjet
2021-04-28 06:29
<a href="http://www.lpfteam.com/nfl-nike-new-york-giants-87-sterling-shepard-royal-blue-backer-long-sleeve-t-shirt-jerseyb">nfl nike new york giants 87 sterling shepard royal blue backer long sleeve t shirt</a> <a href="http://www.annieandpeter.com/personalized-torba-charm-torebkic">personalized torba charm</a>
flatbedinkjet http://www.flatbedinkjet.com/

发表评论:

朱文华 joyimp|@2011-2021 京ICP备16030765号-2