【Git 权威指南】读书笔记 - 和声
主要内容:【Git 协议与工作协同】、【冲突解决】、【Git 里程碑】、【Git 分支】、【远程版本库】、【补丁文件交互】 Git 协议与工作协同 Git 支持的协议 SSH、GIT、HTTP、HTTPS、FTP、FTPS、RSYNC 及前面已经看到的本地协议。 SSH 协议: ssh://[user@]example.com[:port]/path/to/repo.git/ [user@]example.com:path/to/repo.git/ GIT 协议,最常用的只读协议: git://example.com[:port]/path/to/repo.git/ HTTP[S] 协议: http[s]://example.com[:port]/path/to/repo.git/ 强制非快进式推送 git push -f 强制推送,会强制刷新服务器中的版本。 禁止非快进式推送 git --git-dir=/path/to/repos/shared.git config receive.denyNonFastForwards true 冲突解决 拉回操作中的合并 git pull = git fetch + git merge 合并策略 Merge Strategis Git 合并操作支持很多合并策略,默认会选择最适合的合并策略。例如,和一个分支进行合并时会选择 recursive 合并策略,当和两个或两个以上的其他分支进行合并时采用 octopus 合并策略。 git merge [-s <strategy>] [-X <strategy-option>] [<commit>...] This option forces conflicting hunks to be auto-resolved cleanly by favoring our version. git merge -s recursive -X ours [<commit>...] Merge branch obsolete into the current branch, using ours merge strategy: ...