设置代理
git config --global http.proxy http: git config --global https.proxy https:
git config --global http.proxy socks5: git config --global https.proxy socks5:
git config --global --add remote.origin.proxy ""
git config --global --unset http.proxy git config --global --unset https.proxy
git config --global http.https: git config --global https.https:
git config --global http.postBuffer 524288000
199.232.5.194 github.http: 140.82.114.4 github.com
|
递归 clone
git clone --recursive -b v1.23.0 https://github.com/grpc/grpc
//子模块失败时使用 git submodule update --init --recursive
|
创建仓库
创建本地用户
git config --local user.name xxx git config --local user.email xxx@example.com
|
指定私钥
git config core.sshCommand "ssh -i ..\\blogHome"
|
追加注释
如果执行了commit 发现注释要修改可以,通过下面命令使用 vim 编辑。
查看状态
添加当前目录所有改动文件
提交
显示日志
git log
// 获取最后一次提交的时间戳 // %at: author date, UNIX timestamp git log --format=@%at -1
|
显示 tag
获取 tag 代码
显示本地分支
切换分支到test
git branch * br-2.1.2.2 master test
git checkout test git branch br-2.1.2.2 master * test
|
撤销本地修改
git checkout . #本地所有修改的。没有的提交的,都返回到原来的状态 git stash #把所有没有提交的修改暂存到stash里面。可用git stash pop回复。 git reset --hard HASH #返回到某个节点,不保留修改。 git reset --soft HASH #返回到某个节点。保留修改
git clean -df #返回到某个节点 git clean 参数 -n 显示 将要 删除的 文件 和 目录 -f 删除 文件 -df 删除 文件 和 目录
|
撤销跟踪文件