git不常用操作手册

75 阅读1分钟

清除未push的commit信息

git reset --soft HEAD~1 // 1是指几次commit

git reset --soft HEAD~ // 全量撤销未push的commit

创建新分支推送远程

git checkout -b xxx origin/xxx

分支找回

git reflog --date=iso 通过这个命令可以查找具体分支commit信息

image.png

git checkout -b <branchName> <sha> 举例 git checkout -b xxx fe27445

git特定提交回滚

git reset --hard fe27445 git push -f