git 操作汇总【迭代更新中】

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=""
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值