※ git 與 repo 有何不同? (簡單說 git 由是 Linux 作者開發出來的 open source, repo 是 Google 以 python 包裝 git)
※git 與 svn 差異? (git 多了 stage, code commit 後要再 git push / repo upload 才真正上傳到 remote repository)
※如何只下載某 brach 的資料而不要下載全部的 branch 以縮短下載量和時間? (git clone --single-branch 或 git remote set-branches origin <BRANCH>; git fetch)
※git reset --hard 與 --soft 與 --mixed 有何不同? (--soft 只更動 repository 而不 reset working 和 staging 的狀態; --mixed 是 git reset 的預設行為,只保留 working 的狀態而 reset staging 和 repository; --hard 是全都更動)
※git fetch 與 pull 有何不同? (簡單來說 git pull = git fetch + git merge, 所以如果 staging 裡已有 commit 還沒上傳,如果用 git fetch 則會失敗,必須先 git push, 但用 git pull 就比較沒這個問題)
※git reset / revert / rebase 有何不同? (git reset 更改 HEAD 指向的位置、rebase 更改 base 避免 conflict、revert 是再做一個新的 commit,來取消不要的 commit, 若要取消 revert, 就再 revert 一次或 git reset HEAD^ --hard)
※github 與 gitlab 有何不同? (這說來話長請自行爬文吧)
$ git commit -c <SHA> --amend // 修改某 <SHA> 的 commit 的 comment
$ git log --graph --pretty=oneline // 以 ASCII 畫出 branch merge history,並且每一筆紀錄皆以一行敘述
$ git reset --hard HEAD^^ // rollback 到兩筆的狀態
$ git reset --hard HEAD~<N> // rollback 到前 N 筆
$ git reflog // 列出所有對 git 下的指令紀錄,含 SHA, 方便 rollback 過頭的時候還可以回到未來
$ git checkout -- <FILE> // 恢復 <FILE> 到修改前的內容
$ git checkout -b <BRANCH> // git branch <BRANCH> + git checkout <BRANCH>
$ git remote add origin [email protected]:3456/cloud_infra/Auto_Test.git // 以下先 BJ4 不解釋,或等我有空再補充
$ git reset HEAD <FILE>
$ git merge --no-ff <BRANCH>
$ git branch -d <BRANCH>
$ git push -u origin master
$ git stash list/apply
$ git remote -v
$ git rebase
$ git reset
$ git revert HEAD --no-edit
$ git fetch --prune
$ git tag