文章目录
0x1初始化操作
0x11 生成公钥
ssh-keygen
0x12 配置账号和邮箱
git config --global user.name username
git config --global user.email uaername@163.com
0x2
0x21 拉取代码
git clone https://github.com/torvalds/linux.git
0x22 推送代码
git push local_branch:remote_branch
git push master:master
0x23 设置远端分支
git branch --set-upstream-to=origin/v8.2.0
0x3
0x31 提交mr
git review
0x4
0x41 子模块
git submodule init 初始化子模块
git submodule update 更新子模块
0x42 子模块添加
git init
git submodule add http://xxx.xxx/common.git
git submodule add http://xxx.xxx/framework.git
0x5 rebase
0x51
git rebase是一个很好用的命令
常用操作
压缩多个commit为一个commit
git rebase -i comiit-id[需要压缩的commit的前一个commit]
设置proxy
git的proxy
# 设置git的proxy
git config --global http.proxy http://root:12345@proxycn2.huawei.com:8080/
git config --global https.proxy http://root:12345@proxycn2.huawei.com:8080/
git config --global http.sslVerify false
# 取消git的proxy
git config --global --unset http.proxy
git config --global --unset https.proxy
shell的proxy
# 设置proxy
export http_proxy=http://root:12345@proxycn2.huawei.com:8080
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export no_proxy=127.0.0.1,.huawei.com,localhost,.local
# 取消proxy
export http_proxy=""
export https_proxy=""