git push
git push <远程主机名> <本地分支名>:<远程分支名>
实例
git push origin master:master
git pull
git pull <远程主机名> <远程分支名>:<本地分支名>
实例
git pull origin master:master
git pull --rebase
实例
git pull --rebase origin master:master
效果
graph LR
cid1 --> cid2 -."origin".-> cid3
cid2 -.local.-> cid4
执行 git pull --rebase 后
graph LR
subgraph Local
n1[cid1] --> n2[cid2] --> n3[cid3] -.-> cid4
end
原理
graph RL
wd[working directory]
wd --"(2) git pull --rebase"--> repo[Git Repository]
subgraph Local
wd --"(1) git stash"--> stash
stash --"(3) git stash pop"--> wd[working directory]
end
git config
单项目
git config --local
全局
git config --global
查看代理
git config --global --get http.proxy
设置代理
socks代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
http/https代理
git config --global http.proxy http://127.0.0.1:8080
git config --global https.proxy https://127.0.0.1:8080
取消代理
git config --local --unset http.proxy
git config --local --unset https.proxy