版本回退

git reset --hard gitcode
git push origin HEAD --force

分支操作

git push -f origin master
git checkout [branchname] 切换分支
git pull origin nayi

配置

git config --global user.email “951634379@qq.com”
git config --global user.name “luopu”
git config --global core.editor “vi”

保存密码

[credential]
helper = store
push之后才有作用?
git config --global credential.helper store

非bare的git仓库允许其他仓库push

git config receive.denyCurrentBranch ignore --global
post-update.sample改名为post-update加入如下内容
#exec git update-server-info
unset GIT_DIR
cd …
git checkout -f

git checkout -b v2.0.0_hls origin/v2.0.0_hls
git remote set-url origin root@172.16.6.36:/root/cifs/host/taaMaster

git config receive.denyCurrentBranch ignore

git clone -b v2.0.0_langfang http://gitlab.lanxum.net/engine/TAA.git
git clone -b v2.0.0_langfang http://172.16.1.236/engine/TAA.git

pull某个分支
git pull origin nari

vpn远程推送错误,但实际更新完成
$ git push origin nari
root@172.16.212.3’s password:
Esing objects: 100% (250/250), done.
Writing objects: 100% (266/266), 2.38 MiB | 81.00 KiB/s, done.
Total 266 (delta 199), reused 0 (delta 0)
remote: error: cannot lock ref ‘refs/heads/nari’: ref refs/heads/nari is at 2b6cdd6b4ae0a575d9dabfca57f555e3fabe but expected 666183e5f6a09e053ff4b922d7aa9881ddeb

代理

git config --global http.proxy http://IP:Port

修改.gitignore时,已经跟踪了一些,需要这样处理(.gitignore看起来未生效时)
git rm -r --cached .
git add .

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐