git命令

野生程序员2020年6月6日
大约 1 分钟

more git命令

代理

#使用http代理 
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
#使用socks5代理
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080


#使用socks5代理(推荐)
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
#使用http代理(不推荐)
git config --global http.https://github.com.proxy http://127.0.0.1:1080


取消代理

git config --global --unset http.proxy
git config --global --unset https.proxy

克隆项目

git clone https://github.com/qq547176052/qq547176052.git

在命令行上创建一个新的仓库

echo "# 547176052" >> README.md
git init
git add README.md
git commit -m "1.0.0"

git remote add origin https://github.com/qq547176052/qq547176052.git
git branch -M master
设置分支
git push --set-upstream origin master
git push -u origin master

添加多个仓库

git remote add origin https://gitee.com/wdbj/wdbj.git
git remote set-url --add origin https://github.com/qq547176052/547176052.git

推送现有的仓库

git add .
git commit -m "2.6.5"
git push -u origin master

强制推送

git push -f origin master

查看当前仓库地址

git remote show origin

设置新的仓库地址

git remote set-url origin https://github.com/qq547176052/547176052.git

git remote add origin https://github.com/qq547176052/547176052.git

本地项目恢复到指定版本

git reset --hard b2232b89cbd104f13a2fdd601fa58931ddeab1fd
上次编辑于: 2022/8/15 22:55:29
贡献者: qq547176052
评论
Powered by Waline v2.6.3