ssh-keygen -t rsa -C "A@hotmail.com"
vim ~/.ssh/config
複製代碼
編輯html
Host github
Host github
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Host gitlib
Host gitlib
HostName gitlib.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_ant
複製代碼
代碼合併,修改註釋而且合併註釋。產生的結果是分支不產生分叉。git
git rebase origin/master
## 修改衝突
git add .
git rebase --continue
複製代碼
git show commitId | HEAD^
複製代碼
git stash
git stash save
# 查看儲藏的東西
git stash list
# 從棧上刪除儲藏
git stash drop stash@{2}
# 應用後當即刪除
git stash pop
複製代碼
工做區(Working directory:checkout) -> 緩存區(Index:git add) -> 提交區(Head:git commit)github
## 回到git add以後的狀態。
git reset --soft HEAD^
複製代碼
## 回到git add以前的狀態。
git reset --mixed HEAD^
複製代碼
git reset --hard commitId | HEAD^
複製代碼
git commit --amend -m "xxx"
複製代碼
git revert HEAD
git push origin master
複製代碼
git reset --hard HEAD^
git push origin branch -f
複製代碼
git checkout -b branch origin/branch
複製代碼