git使用备忘录

来源:互联网 发布:sql replace替换多个 编辑:程序博客网 时间:2024/06/05 22:39

1.合并所有提交成一次,并且推到主分支

//合并提交
git reset --soft 起点hash,自己提交前的一次提交的hash // 在本地取消多次提交
git commit //合并成一次提交
git checkout develop//切换到dev
git log 自己的分支名 //查看和合并后提交的hash值a
git cherry-pick a
//如果有冲突
git checkout 自己的分支名 冲突文件夹
git commit
git push


2.删除远程分支以及tag

git push origin --delete 要删除的分支名或tag。


3.创建并推送分支到远程,绑定本地分支

① git branch 分支名

② git push -u origin 分支名


4.撤销提交:

git reset —hard commitid  //撤销本地顶层提交,(没有push的)

git revert commitid //恢复远程已经push的提交的本次修改。


0 0