亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
characters

命名

giteveryday  -  Everyday Git 的一組有用的最小命令

概要

每天 Git 有20個命令或者如此

描述

Git 用戶可以大致分為四類,用于描述日常 Git 的一小部分有用命令。

  • 個人開發(fā)者(獨立)命令對于任何進行提交的人都是必不可少的,即使對于單獨工作的人也是如此。

  • 如果您與其他人一起工作,您還需要個人開發(fā)者(參與者)部分中列出的命令。

  • 扮演集成角色的人除了需要上面的內(nèi)容外,還需要學習更多的命令。

  • 存儲庫管理命令用于負責照顧和提供 Git 存儲庫的系統(tǒng)管理員。

個人開發(fā)者(獨立)

獨立的個人開發(fā)人員不會與其他人交換補丁,并使用以下命令單獨在單個資源庫中工作。

  • git-init [1]創(chuàng)建一個新的存儲庫。

  • git-log [1]看看發(fā)生了什么。

  • git-checkout [1]和git-branch [1]來切換分支。

  • git-add [1]來管理索引文件。

  • git-diff [1]和git-status [1]來查看你在做什么。

  • git-commit [1]推進當前分支。

  • git-reset [1]和git-checkout [1](帶路徑名參數(shù))撤銷更改。

  • git-merge [1]在本地分支之間合并。

  • git-rebase [1]維護主題分支。

  • git-tag [1]標記已知點。

例子

使用 tarball 作為新存儲庫的起點。

$ 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. 在當前目錄下添加所有內(nèi)容。

  2. 制作一個輕量級,不帶標簽的標簽。

創(chuàng)建主題分支并進行開發(fā)。

$ 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. 創(chuàng)建一個新的主題分支。

  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標記,只查看觸及目錄內(nèi)容的更改。

個人開發(fā)者(參與者)

作為團隊項目參與者的開發(fā)人員需要學習如何與他人溝通,并使用這些命令以及獨立開發(fā)人員所需的命令。

  • git-clone [1] 從上游遷移到本地存儲庫。

  • git-pull [1] 和 git-fetch [1]從 “origin” 與上游保持同步。

  • 如果您采用 CVS 風格的共享存儲庫工作流,請將 git-push [1] 共享存儲庫。

  • git-format-patch [1] 準備電子郵件提交,如果你采用 Linux 內(nèi)核式的公共論壇工作流程。

  • git-send-email [1] 發(fā)送您的電子郵件提交沒有由您的 MUA 腐敗。

  • git-request-pull [1] 為你的上游創(chuàng)建一個變更摘要。

例子

克隆上游并開始工作。Feed 更改為上游。

$ 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. 根據(jù)需要重復。

  3. 從你的分支中提取補丁,相對于主,

  4. 并給他們發(fā)郵件。

  5. 返回master,準備好看看有什么新鮮事

  6. git pullorigin默認提取并合并到當前分支。

  7. 在拉動后立即查看自上次檢查以來上游所做的更改,僅限于我們感興趣的區(qū)域。

  8. 檢查外部存儲庫中的分支名稱(如果未知)。

  9. ALL特定存儲庫的特定分支中獲取并合并它。

  10. 恢復拉力。

  11. 垃圾收集回復拉的剩余物品。

推入另一個存儲庫。

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. 母機在您的主目錄下有一個 frotz 存儲庫; 從它克隆到在衛(wèi)星機器上啟動存儲庫。

  2. 克隆默認設置這些配置變量。它安排git pull將母機分支機構存放到當?shù)氐?code>remotes/origin/*遠程追蹤分支機構。

  3. 安排git push將所有當?shù)胤种C構推到母機的相應分支。

  4. 推動將把我們所有的工作都remotes/satellite/*放在母機上的遠程跟蹤分支上。你可以用它作為備份方法。同樣,你可以假裝母親從你身上“獲取”(當訪問是單方面時很有用)。

  5. 在母機上,將在衛(wèi)星機器上完成的工作合并到主分支中。

分支出一個特定的標簽。

$ 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. 創(chuàng)建一個基于眾所周知的(但有點落后的)標簽的私人分支。

  2. private2.6.14分支中的所有更改轉(zhuǎn)發(fā)到master分支,而無需正式的“合并”?;蛘呤峭绞之?git format-patch -k -m --stdout v2.6.14..private2.6.14 |   git am -3 -k

另一個參與者提交機制正在使用git request-pull或拉請求機制(例如 GitHub(www.github.com)上使用的機制來通知您上游的貢獻。

集成

作為集體項目集成者的一個相當中心的人接收其他人所做的更改,審核并整合他們,并將結果發(fā)布給其他人使用,除了參與者需要的命令之外,還使用這些命令。

這部分內(nèi)容也可供那些git request-pull對 GitHub(www.github.com)作出響應或請求將其他人的工作整合到其歷史中的人使用。儲存庫的一個子區(qū)域中尉將扮演參與者和集成者的角色。

  • git-am [1] 應用從您的貢獻者電子郵件發(fā)送的補丁。

  • git-pull [1] 從你信任的副手中合并。

  • git-format-patch [1] 準備并向貢獻者發(fā)送推薦替代方案。

  • git-revert [1] 撤消拙劣的提交。

  • git-push [1] 發(fā)布出血的邊緣。

例子

典型并集成的 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,nextpu(潛在的更新)。

  3. 閱讀郵件,保存適用的郵件,并保存其他未準備好的郵件(其他郵件閱讀器可用)。

  4. 以交互方式將它們應用于您的簽名。

  5. 根據(jù)需要創(chuàng)建主題分支并再次應用簽名。

  6. rebase 內(nèi)部主題分支尚未合并到主或作為穩(wěn)定分支的一部分公開。

  7. pu每次從下一次重新啟動。

  8. 并捆綁主題分支仍在烹飪。

  9. 支持重要的修復。

  10. 創(chuàng)建一個簽名標簽。

  11. 確保主人不會意外地重新超出已經(jīng)推出的水平。

  12. 在輸出中git show-branch,master應該擁有一切ko/master,并且next應該擁有一切ko/next,等等。

  13. 推出流血的邊緣,以及指向推送歷史的新標簽。

在這個例子中,ko簡寫指向 Git 維護者在 kernel.org 的倉庫,看起來像這樣:

(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

存儲庫管理

存儲庫管理員使用以下工具來設置和維護開發(fā)人員對存儲庫的訪問。

  • git-daemon [1] 允許匿名從版本庫下載。

  • git-shell [1] 可以用作restricted login shell共享中央資源庫用戶。

  • git-http-backend [1] 提供了允許提取和推送服務的 Git-over-HTTP(“Smart http”)的服務器端實現(xiàn)。

  • gitweb [1] 為 Git 存儲庫提供了 Web 前端,可以使用 git-instaweb [1] 腳本進行設置。

更新 hook howto 有一個管理共享中央存儲庫的好例子。

此外,還有其他一些廣泛部署的托管,瀏覽和審查解決方案,例如:

  • gitolite,gerrit 代碼審查,cgit 和其他。

例子

我們在 / etc / services 的假設如下

$ grep 9418 /etc/services
git                9418/tcp                # Git Version Control System

運行 git-daemon 來從 inetd 提供 / pub / scm 。

$ grep git /etc/inetd.conf
git        stream        tcp        nowait        nobody \  /usr/bin/git-daemon git-daemon --inetd --export-all /pub/scm

實際的配置線應該在一條線上。

運行 git-daemon 以從 xinetd 提供 / pub / scm 。

$ 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 系統(tǒng)。其他可能不同。

給使用 git-over-ssh 的開發(fā)人員提供 push/pull 的訪問權限。

例如那些使用: $ 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 ,它不允許任何內(nèi)容git pushgit pull。用戶需要 ssh 訪問機器。

  2. 在許多發(fā)行版中,/ etc / shells 需要列出用作登錄 shell 的內(nèi)容。

CVS 風格的共享庫。

$ 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. 將開發(fā)人員放入同一個 git 組中。

  2. 并使共享存儲庫可由組寫入。

  3. 使用來自 Documentation / howto / for 分支策略控制的 Carl 的更新鉤子示例。

  4. 愛麗絲和辛迪可以推進主人,只有鮑勃可以推入文檔更新。david 是發(fā)布經(jīng)理,是唯一可以創(chuàng)建和推送版本標簽的人。

Previous article: Next article: