<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # giteveryday > 原文: [https://git-scm.com/docs/giteveryday](https://git-scm.com/docs/giteveryday) ## 名稱 giteveryday - Everyday Git的一組有用的最小命令 ## 概要 每日Git有20個命令或者所以 ## 描述 為了在這里描述日常Git的一小組有用命令,Git用戶可以大致分為四類。 * [個人開發者(獨立)](#STANDALONE)命令對任何提交者都是必不可少的,即使對于單獨工作的人也是如此。 * 如果您與其他人一起工作,您還需要[個人開發者(參與者)](#PARTICIPANT)部分中列出的命令。 * 扮演 [Integrator](#INTEGRATOR) 角色的人除了上述之外還需要學習更多命令。 * [存儲庫管理](#ADMINISTRATION)命令適用于負責Git存儲庫的維護和提供的系統管理員。 ## 個人開發者(獨立) 獨立的開發人員不會與其他人交換補丁,而是使用以下命令單獨在單個存儲庫中工作。 * [git-init [1]](https://git-scm.com/docs/git-init) 創建一個新的存儲庫。 * [git-log [1]](https://git-scm.com/docs/git-log) 看看發生了什么。 * [git-checkout [1]](https://git-scm.com/docs/git-checkout) 和 [git-branch [1]](https://git-scm.com/docs/git-branch) 切換分支。 * [git-add [1]](https://git-scm.com/docs/git-add) 來管理索引文件。 * [git-diff [1]](https://git-scm.com/docs/git-diff) 和 [git-status [1]](https://git-scm.com/docs/git-status) 看你正在做什么。 * [git-commit [1]](https://git-scm.com/docs/git-commit) 推進當前分支。 * [git-reset [1]](https://git-scm.com/docs/git-reset) 和 [git-checkout [1]](https://git-scm.com/docs/git-checkout) (帶路徑名參數)撤消更改。 * [git-merge [1]](https://git-scm.com/docs/git-merge) 在本地分支之間合并。 * [git-rebase [1]](https://git-scm.com/docs/git-rebase) 維護主題分支。 * [git-tag [1]](https://git-scm.com/docs/git-tag) 標記已知點。 ### 例子 ``` Use a tarball as a starting point for a new repository. ``` ``` $ tar zxf frotz.tar.gz $ cd frotz $ git init $ git add . (1) $ git commit -m "import of frotz source tree." $ git tag v2.43 (2) ``` 1. 添加當前目錄下的所有內容。 2. 制作一個輕量級,未注釋的標簽。 ``` Create a topic branch and develop. ``` ``` $ git checkout -b alsa-audio (1) $ edit/compile/test $ git checkout -- curses/ux_audio_oss.c (2) $ git add curses/ux_audio_alsa.c (3) $ edit/compile/test $ git diff HEAD (4) $ git commit -a -s (5) $ edit/compile/test $ git diff HEAD^ (6) $ git commit -a --amend (7) $ git checkout master (8) $ git merge alsa-audio (9) $ git log --since='3 days ago' (10) $ git log v2.43.. curses/ (11) ``` 1. 創建一個新的主題分支。 2. 恢復`curses/ux_audio_oss.c`中的拙劣變化。 3. 你需要告訴Git你是否添加了一個新文件;如果您稍后執行`git commit -a`,將會刪除和修改。 4. 看看你提出了哪些改變。 5. 如您所測試的那樣,通過您的簽名來承諾所有內容。 6. 查看所有更改,包括之前的提交。 7. 修改先前的提交,使用原始郵件添加所有新更改。 8. 切換到主分支。 9. 將主題分支合并到主分支中。 10. 審核提交日志;可以組合限制輸出的其他形式,包括`-10`(最多顯示10次提交),`--until=2005-12-10`等。 11. 僅查看觸及`curses/`目錄中的內容的更改,因為`v2.43`標記。 ## 個人開發者(參與者) 作為組項目參與者的開發人員需要學習如何與他人通信,并且除了獨立開發人員所需的命令之外還使用這些命令。 * [git-clone [1]](https://git-scm.com/docs/git-clone) 從上游到本地存儲庫。 * 來自“origin”的 [git-pull [1]](https://git-scm.com/docs/git-pull) 和 [git-fetch [1]](https://git-scm.com/docs/git-fetch) 與上游保持同步。 * [git-push [1]](https://git-scm.com/docs/git-push) 到共享存儲庫,如果采用CVS樣式的共享存儲庫工作流程。 * [git-format-patch [1]](https://git-scm.com/docs/git-format-patch) 準備電子郵件提交,如果采用Linux內核式公共論壇工作流程。 * [git-send-email [1]](https://git-scm.com/docs/git-send-email) 發送您的電子郵件提交而不會被您的MUA損壞。 * [git-request-pull [1]](https://git-scm.com/docs/git-request-pull) 創建上游拉動變化的摘要。 ### 例子 ``` Clone the upstream and work on it. Feed changes to upstream. ``` ``` $ git clone git://git.kernel.org/pub/scm/.../torvalds/linux-2.6 my2.6 $ cd my2.6 $ git checkout -b mine master (1) $ edit/compile/test; git commit -a -s (2) $ git format-patch master (3) $ git send-email --to="person <email@example.com>" 00*.patch (4) $ git checkout master (5) $ git pull (6) $ git log -p ORIG_HEAD.. arch/i386 include/asm-i386 (7) $ git ls-remote --heads http://git.kernel.org/.../jgarzik/libata-dev.git (8) $ git pull git://git.kernel.org/pub/.../jgarzik/libata-dev.git ALL (9) $ git reset --hard ORIG_HEAD (10) $ git gc (11) ``` 1. 從主人那里結帳一個新的分支`mine`。 2. 根據需要重復。 3. 從你的分支中提取補丁,相對于主人, 4. 并發送電子郵件 5. 返回`master`,準備好看看有什么新東西 6. `git pull`默認從`origin`獲取并合并到當前分支。 7. 拉動后立即查看自上次檢查以來上游所做的更改,僅在我們感興趣的區域內。 8. 檢查外部存儲庫中的分支名稱(如果未知)。 9. 從特定存儲庫中獲取特定分支`ALL`并合并它。 10. 恢復拉力。 11. 垃圾從恢復的拉動中收集剩余的物體。 ``` Push into another repository. ``` ``` satellite$ git clone mothership:frotz frotz (1) satellite$ cd frotz satellite$ git config --get-regexp '^(remote|branch)\.' (2) remote.origin.url mothership:frotz remote.origin.fetch refs/heads/*:refs/remotes/origin/* branch.master.remote origin branch.master.merge refs/heads/master satellite$ git config remote.origin.push \ +refs/heads/*:refs/remotes/satellite/* (3) satellite$ edit/compile/test/commit satellite$ git push origin (4) mothership$ cd frotz mothership$ git checkout master mothership$ git merge satellite/master (5) ``` 1. motherhip機器在你的主目錄下有一個frotz存儲庫;從中克隆以在衛星機器上啟動存儲庫。 2. clone默認設置這些配置變量。它安排`git pull`來獲取和存儲母艦機器的分支到本地`remotes/origin/*`遠程跟蹤分支機構。 3. 安排`git push`將所有本地分支機構推送到母艦機器的相應分支機構。 4. push將把我們所有的工作都藏在母艦機器上的`remotes/satellite/*`遠程跟蹤分支上。您可以將其用作備份方法。同樣地,你可以假裝母艦從你那里“取出”(當訪問是單方面時很有用)。 5. 在母艦機器上,將衛星機器上完成的工作合并到主分支機構中。 ``` Branch off of a specific tag. ``` ``` $ git checkout -b private2.6.14 v2.6.14 (1) $ edit/compile/test; git commit -a $ git checkout master $ git cherry-pick v2.6.14..private2.6.14 (2) ``` 1. 基于眾所周知(但略微落后)的標簽創建一個私有分支。 2. 將`private2.6.14`分支中的所有更改轉發到`master`分支,而不進行正式的“合并”。或者手寫 `git format-patch -k -m --stdout v2.6.14..private2.6.14 | git am -3 -k` 備用參與者提交機制使用`git request-pull`或拉取請求機制(例如,在GitHub(www.github.com)上使用)向您的上游通知您的貢獻。 ## 積分 作為集體項目中的集成商的相當核心的人接收他人所做的更改,審查和集成他們并發布結果供其他人使用,除了參與者需要的命令之外還使用這些命令。 在GitHub(www.github.com)上回復`git request-pull`或pull-request以將其他人的工作整合到他們的歷史中的人也可以使用此部分。存儲庫的子區域中尉既可以作為參與者也可以作為集成者。 * [git-am [1]](https://git-scm.com/docs/git-am) 應用您的貢獻者通過電子郵件發送的補丁。 * [git-pull [1]](https://git-scm.com/docs/git-pull) 從您信任的副手中合并。 * [git-format-patch [1]](https://git-scm.com/docs/git-format-patch) 準備并發送建議的替代貢獻者。 * [git-revert [1]](https://git-scm.com/docs/git-revert) 撤消拙劣的提交。 * [git-push [1]](https://git-scm.com/docs/git-push) 發布前沿。 ### 例子 ``` A typical integrator’s Git day. ``` ``` $ git status (1) $ git branch --no-merged master (2) $ mailx (3) & s 2 3 4 5 ./+to-apply & s 7 8 ./+hold-linus & q $ git checkout -b topic/one master $ git am -3 -i -s ./+to-apply (4) $ compile/test $ git checkout -b hold/linus && git am -3 -i -s ./+hold-linus (5) $ git checkout topic/one && git rebase master (6) $ git checkout pu && git reset --hard next (7) $ git merge topic/one topic/two && git merge hold/linus (8) $ git checkout maint $ git cherry-pick master~4 (9) $ compile/test $ git tag -s -m "GIT 0.99.9x" v0.99.9x (10) $ git fetch ko && for branch in master maint next pu (11) do git show-branch ko/$branch $branch (12) done $ git push --follow-tags ko (13) ``` 1. 看看你在做什么,如果有的話。 2. 看哪些分支還沒有合并到`master`中。對于任何其他集成分支,例如, `maint`,`next`和`pu`(潛在更新)。 3. 閱讀郵件,保存適用的郵件,并保存其他尚未準備好的郵件(其他郵件閱讀器可用)。 4. 以交互方式應用它們與您的簽字。 5. 根據需要創建主題分支并再次應用簽名。 6. rebase內部主題分支,尚未合并到主服務器或作為穩定分支的一部分公開。 7. 每次從下一次重啟`pu`。 8. 捆綁主題分支仍在烹飪。 9. backport一個關鍵修復。 10. 創建簽名標記。 11. 確保主人不會被意外地重繞,而不是已經被推出。 12. 在`git show-branch`的輸出中,`master`應該包含`ko/master`的所有內容,`next`應該具有`ko/next`所具有的所有內容等。 13. 推出最前沿,以及指向推動歷史的新標簽。 在這個例子中,`ko`簡寫點在kernel.org的Git維護者的存儲庫中,看起來像這樣: ``` (in .git/config) [remote "ko"] url = kernel.org:/pub/scm/git/git.git fetch = refs/heads/*:refs/remotes/ko/* push = refs/heads/master push = refs/heads/next push = +refs/heads/pu push = refs/heads/maint ``` ## 存儲庫管理 存儲庫管理員使用以下工具來設置和維護開發人員對存儲庫的訪問權限。 * [git-daemon [1]](https://git-scm.com/docs/git-daemon) 允許從存儲庫匿名下載。 * [git-shell [1]](https://git-scm.com/docs/git-shell) 可以用作共享中央存儲庫用戶的_受限登錄shell_ 。 * [git-http-backend [1]](https://git-scm.com/docs/git-http-backend) 提供了Git-over-HTTP(“Smart http”)的服務器端實現,允許提取和推送服務。 * [gitweb [1]](https://git-scm.com/docs/gitweb) 為Git存儲庫提供了一個Web前端,可以使用 [git-instaweb [1]](https://git-scm.com/docs/git-instaweb) 腳本進行設置。 [update hook howto](howto/update-hook-example.html) 有一個管理共享中央存儲庫的好例子。 此外,還有許多其他廣泛部署的托管,瀏覽和審查解決方案,例如: * gitolite,gerrit code review,cgit等。 ### 例子 ``` We assume the following in /etc/services ``` ``` $ grep 9418 /etc/services git 9418/tcp # Git Version Control System ``` ``` Run git-daemon to serve /pub/scm from inetd. ``` ``` $ grep git /etc/inetd.conf git stream tcp nowait nobody \ /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm ``` 實際配置行應該在一行上。 ``` Run git-daemon to serve /pub/scm from xinetd. ``` ``` $ cat /etc/xinetd.d/git-daemon # default: off # description: The Git server offers access to Git repositories service git { disable = no type = UNLISTED port = 9418 socket_type = stream wait = no user = nobody server = /usr/bin/git-daemon server_args = --inetd --export-all --base-path=/pub/scm log_on_failure += USERID } ``` 檢查你的xinetd(8)文檔和設置,這是來自Fedora系統。其他人可能會有所不同 ``` Give push/pull only access to developers using git-over-ssh. ``` 例如那些使用:`$ git push/pull ssh://host.xz/pub/scm/project` ``` $ grep git /etc/passwd (1) alice:x:1000:1000::/home/alice:/usr/bin/git-shell bob:x:1001:1001::/home/bob:/usr/bin/git-shell cindy:x:1002:1002::/home/cindy:/usr/bin/git-shell david:x:1003:1003::/home/david:/usr/bin/git-shell $ grep git /etc/shells (2) /usr/bin/git-shell ``` 1. 登錄shell設置為/ usr / bin / git-shell,除了`git push`和`git pull`之外不允許任何其他內容。用戶需要ssh訪問機器。 2. 在許多發行版/ etc / shells中需要列出用作登錄shell的內容。 ``` CVS-style shared repository. ``` ``` $ grep git /etc/group (1) git:x:9418:alice,bob,cindy,david $ cd /home/devo.git $ ls -l (2) lrwxrwxrwx 1 david git 17 Dec 4 22:40 HEAD -> refs/heads/master drwxrwsr-x 2 david git 4096 Dec 4 22:40 branches -rw-rw-r-- 1 david git 84 Dec 4 22:40 config -rw-rw-r-- 1 david git 58 Dec 4 22:40 description drwxrwsr-x 2 david git 4096 Dec 4 22:40 hooks -rw-rw-r-- 1 david git 37504 Dec 4 22:40 index drwxrwsr-x 2 david git 4096 Dec 4 22:40 info drwxrwsr-x 4 david git 4096 Dec 4 22:40 objects drwxrwsr-x 4 david git 4096 Nov 7 14:58 refs drwxrwsr-x 2 david git 4096 Dec 4 22:40 remotes $ ls -l hooks/update (3) -r-xr-xr-x 1 david git 3536 Dec 4 22:40 update $ cat info/allowed-users (4) refs/heads/master alice\|cindy refs/heads/doc-update bob refs/tags/v[0-9]* david ``` 1. 將開發人員放在同一個git組中。 2. 并使該組可寫的共享存儲庫。 3. 使用來自Documentation / howto /的Carl的update-hook示例進行分支策略控制。 4. alice和cindy可以推入主人,只有bob可以推進doc-update。 david是發布經理,是唯一可以創建和推送版本標簽的人。 ## GIT 部分 [git [1]](https://git-scm.com/docs/git) 套件
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看