Skip to content

Instantly share code, notes, and snippets.

@biezhi
Last active May 7, 2017
Embed
What would you like to do?
git常用命令

把本地的dev分支强制(-f)推送到远程master

git push origin dev:master -f

删除远程分支

git push origin --delete <branchName>

删除tag

git push origin --delete tag <tagname>

本地分支替换远程分支,远程commit会变成1

git push origin master --force

git push origin master -f

添加远程链接

git remote rm origin 
git remote add origin https://git.oschina.net/biezhi/xxx.git

回退到某个版本

git reset --hard <commit_id>
git push origin HEAD --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment