GIT常用命令

常用git命令

git push origin develop:master -f把本地develop强推到master

git push origin tagname 推送Tag

当第一次输入错错误的git密码后,以后push只会报fatal: Authentication failed for通过使用git config --system --unset credential.helper来重置重新输入用户名密码

知道commitID查询在哪个分支

#查本地所有分支
git branch --contains CommitID
#查远程所有分支
git branch -r --contains CommitID
#查本地和远程的所有分支
git branch -a --contains CommitID
#合并后想重置
git reset --hard 未合并前的hash
合并后未提交不想合并
git merge --abort

使用镜像clone仓库

在github.com后面加github.com.cnmjs.org

合并后撤销

先使用git reflog查找到切换分支前的hash
再使用git reset --hard hash来切换到之前
posted @ 2020-12-01 16:45  onedayrex  阅读(65)  评论(0)    收藏  举报