记不住的:git操作

一些git操作。我是真的记不住啊。

git 配置

1
2
git config --global user.name "喵叔catuncle"
git config --global user.email "andych008@163.com"

ssh密钥

1
2
ssh-keygen -t rsa -C "andych008@163.com" #生成ssh密钥文件
ssh git@github.com

更改上一个commit的作者

1
2
git commit --amend --author "喵叔catuncle <andych008@163.com>"
git push -f

常用git ssh config

1
2
3
4
5
6
7
8
# cat 
host github.com

# cat
host gitee.com

# cat
host git.dev.tencent.com

拉取特定的分支

1
git clone -b xxx http://xxx.git

track remote跟踪一个远程分支

1
2
-u, --set-upstream-to <upstream>
change the upstream info
1
git branch -u origin/dev