<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      git使用標準

      git 使用規(guī)范

      團隊開發(fā)中,要遵循一個合理、清晰的git使用流程非常重要的。否則每個人提交一堆雜亂我長的commit,項目很快就變得難以協(xié)調(diào)和維護

      第一步:創(chuàng)建新分支

      首先,每一次開發(fā)新功能,都應該新建一個單獨的分支

      # 獲取主干最新代碼
      $ git checkout master
      $ git pull
      # 新建一個開發(fā)分支myfeature
      $ git checkout -b myfeature
      

      第二步:提交分支commit

      分支修改完后就可以commit了

      $ git add --all
      $ git status
      $ git commit --verbose
      

      git add 命令的all參數(shù),表示保存所有的變化(包括新建、修改和刪除)。可用git add . 代替
      git status命令,用來查看發(fā)生變動的文件
      git commit 命令的verbose參數(shù),會列出diff的結果

      第三步:撰寫提交信息

      提交commit時,必須給出完整扼要的提交信息。第一行是不超過50個字的提要,然后空一行,羅列出改動原因、主要變動、以及需要注意的問題。

      # git 每次提交代碼,都要寫commit message(提價說明),否則就不允許提價。
      $ git commit -m "hello world"
      # 上面代碼的-m參數(shù),就是用來指定 commit mesage 的。
      # 如果一行不夠,可以只執(zhí)行git commit,就會跳出文本編譯器,讓你寫多行。
      $ git commit
      
      

      第四步:與主干同步

      分支的開發(fā)過程中,要經(jīng)常與主干保持同步

      $ git fetch origin
      $ git rebase origin/master
      

      第五步:合并commit

      分支開發(fā)完成后,很可能有一堆commit,但是合并到主干的時候,往往希望只有一個(或最多兩三個)commit,這樣不僅清晰,也容易管理。那么,怎樣才能將多個commit合并呢?這就要用到 git rebase 命令。

      $ git rebase -i origin/master
      

      git rebase命令的i參數(shù)表示互動(interactive),這時git會打開一個互動界面,進行下一步操作。下面采用Tute Costa的例子,來解釋怎么合并commit。

      
      pick 07c5abd Introduce OpenPGP and teach basic usage
      pick de9b1eb Fix PostChecker::Post#urls
      pick 3e7ee36 Hey kids, stop all the highlighting
      pick fa20af3 git interactive rebase, squash, amend
      # Rebase 8db7e8b..fa20af3 onto 8db7e8b
      #
      # Commands:
      # p, pick = use commit
      # r, reword = use commit, but edit the commit message
      # e, edit = use commit, but stop for amending
      # s, squash = use commit, but meld into previous commit
      # f, fixup = like "squash", but discard this commit's log message
      # x, exec = run command (the rest of the line) using shell
      #
      # These lines can be re-ordered; they are executed from top to bottom.
      #
      # If you remove a line here THAT COMMIT WILL BE LOST.
      #
      # However, if you remove everything, the rebase will be aborted.
      #
      # Note that empty commits are commented out
      

      上面的互動界面,先列出當前分支最新的4個commit(越下面越新)。每個commit前面有一個操作命令,默認是pick,表示該行commit被選中,要進行rebase操作。4個commit的下面是一大堆注釋,列出可以使用的命令。

      • pick:正常選中
      • reword:選中,并且修改提交信息;
      • edit:選中,rebase時會暫停,允許你修改這個- - commit(參考這里)
      • squash:選中,會將當前commit與上一個commit合并
      • fixup:與squash相同,但不會保存當前commit的提交信息
      • exec:執(zhí)行其他shell命令

      上面這6個命令當中,squash和fixup可以用來合并commit。先把需要合并的commit前面的動詞,改成squash(或者s)。

      pick 07c5abd Introduce OpenPGP and teach basic usage
      s de9b1eb Fix PostChecker::Post#urls
      s 3e7ee36 Hey kids, stop all the highlighting
      pick fa20af3 git interactive rebase, squash, amend
      

      這樣一改,執(zhí)行后,當前分支只會剩下兩個commit。第二行和第三行的commit,都會合并到第一行的commit。提交信息會同時包含,這三個commit的提交信息。

      # This is a combination of 3 commits.
      # The first commit's message is:
      Introduce OpenPGP and teach basic usage
      # This is the 2nd commit message:
      Fix PostChecker::Post#urls
      # This is the 3rd commit message:
      Hey kids, stop all the highlighting
      

      如果將第三行的squash命令改成fixup命令。

      pick 07c5abd Introduce OpenPGP and teach basic usage
      s de9b1eb Fix PostChecker::Post#urls
      f 3e7ee36 Hey kids, stop all the highlighting
      pick fa20af3 git interactive rebase, squash, amend
      

      運行結果相同,還是會生成兩個commit,第二行和第三行的commit,都合并到第一行的commit。但是,新的提交信息里面,第三行commit的提交信息,會被注釋掉。

      # This is a combination of 3 commits.
      # The first commit's message is:
      Introduce OpenPGP and teach basic usage
      # This is the 2nd commit message:
      Fix PostChecker::Post#urls
      # This is the 3rd commit message:
      # Hey kids, stop all the highlighting
      

      squash和fixup命令,還可以當作命令行參數(shù)使用,自動合并commit。

      $ git commit --fixup 
      $ git rebase -i --autosquash
      

      第六步:推送到遠程倉庫

      合并commit后,就可以推送當前分支到遠程倉庫了

      $ git push --force origin myfeature
      

      git push命令要加上force參數(shù),因為rebase以后,分支歷史改變了,跟遠程分支不一定兼容,有可能要強行推送

      git fetch --all  
      git reset --hard origin/master 
      git pull origin master
      
      posted @ 2017-10-09 11:56  zz小公子  閱讀(217)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 国产网友愉拍精品视频| 亚洲一二三四区中文字幕| 国产精品免费看久久久| 日日麻批免费40分钟无码| 亚洲欧美激情另类| 色欲综合久久中文字幕网| 国产精品国产三级国快看| 国产精品尤物午夜福利| 久久精品国产亚洲αv忘忧草| 亚洲国产欧美在线人成AAAA| 一级女性全黄久久片免费| 久久天堂综合亚洲伊人HD妓女 | 亚洲日韩国产精品第一页一区| 亚洲第一香蕉视频啪啪爽| 亚洲日本欧洲二区精品 | 久久夜色精品国产亚洲av| 午夜国产精品福利一二| 精品亚洲女同一区二区| 久久精品99国产精品日本| 久久视频在线视频| 国产精品午夜福利在线观看| 中文一区二区视频| 92国产精品午夜福利| 精品国产福利一区二区在线| 欧洲码亚洲码的区别入口 | 最新日韩精品视频在线| 国产精品成人午夜久久| 又湿又紧又大又爽a视频| 老熟女重囗味hdxx69| 日本大片免A费观看视频三区| 亚洲男女羞羞无遮挡久久丫| 性欧美vr高清极品| 国内精品无码一区二区三区| 激情国产一区二区三区四区| 国产毛a片啊久久久久久保和丸| 人妻精品久久无码区| 一二三四中文字幕日韩乱码| 网友自拍视频一区二区三区| 97中文字幕在线观看| 国内少妇人妻偷人精品视频| 免费国产一区二区不卡|