[TOC]
# git-shortlog
根據每位作者的提交次數而不是作者字母順序對輸出進行排序。
```shell
git shortlog -s -n
```
# git-bisect
git 有一個以二分法幫助定位問題的命令 `bisect`。
```shell
# 開始二分查找問題
git bisect start
# 標記當前有問題
git bisect bad
# 標記哪個 commit 或 tag 時是沒問題的
git bisect good v1.0.0
# 此時 git 會 checkout 兩個點之間的某個 commit,
# 如果此時還是有問題:
git bisect bad
# 如果此時沒有問題:
git bisect good
# 接著 git 會 checkout 下一個「有問題」和「沒問題」之間的 commit
# 直到定位到問題,git 會提示:xxxxxxx is first bad commit
```
# 用 Fetch 和 Merge
[Git 少用 Pull 多用 Fetch 和 Merge](https://www.oschina.net/translate/git-fetch-and-merge)
# git add -A和git add .區別
**一.版本導致的差別:**
1.x版本:
(1).`git add all` 可以提交未跟蹤、修改和刪除文件。
(2).`git add .` 可以提交未跟蹤和修改文件,但是不處理刪除文件。
2.x版本:
兩者功能在提交類型方面是相同的。
**二.所在目錄不同導致的差異:**
(1).`git add all` 無論在哪個目錄執行都會提交相應文件。
(2).`git add .` 只能夠提交當前目錄或者它后代目錄下相應文件。
(3).`git add -u` ?提交被修改(modified)和被刪除(deleted)文件,不包括新文件(new)
# `git push -u`
"Upstream" would refer to the main repo that other people will be pulling from, e.g. your GitHub repo. The `-u` option automatically sets that **upstream** for you, linking your repo to a central one.
That way, in the future, Git "knows" where you want to push to and where you want to pull from, so you can use `git pull` or `git push` without arguments.
A little bit down, [this article](http://mislav.uniqpath.com/2010/07/git-tips/) explains and demonstrates this concept.
# `git pull` & `git fetch`
- 介紹
- 1. Get Git - 安裝并且設置Git
- 2. Repository - 建立一個本地的repository
- 3. Commit to it - 檢查狀態、新增或修改commits
- 4. GitHubbin - 注冊GitHub帳號
- 5. Remote Control - 將repository做本地和遠程的連接
- 6. Forks and Clones - Fork和clone一個開源的計劃
- 7. Branches aren't just for Birds - 建立一個feature branch
- Git分支開發模型
- 8. It's a Small World - 邀請并和別人合作
- 9. Pull, Never Out of Date - 利用Push和pull來和GitHub.com同步
- 10. Requesting You Pull Please - 建立一個pull request
- 11. Merge Tada - Merge和刪除branches
- 學會 GitHub
- GitHub 使用指南
- git 與 github 模板配置
- GitHub Actions
- 實用技巧
- Git Flow
- Submodule子模塊
- 工作記錄
- 常用命令
- 幫助
- 資源
- 解疑答惑