git merge方法

git merge --参数 branch_name
git merge参数
1、--squash  合并的分支,以一个提交被合入

 

2、--no-ff  保存合并的分支的记录,被合并分支有记录

 

使用git reset --hard HEAD^  回退到上一个版本,此种方法可以直接回退到主分支合并之前;
git reset --hard HEAD^^回退到上上个版本,

git reset --hard HEAD~100 回退到上100个提交

 

git reset --hard <commit_id> 命令修改 HEAD 的指向的 commit_id 来达到版本回退的目的

3、--ff  

效果等同fast-forward ,如果分支可以通过移动头指针来完成合并,就是fast-forward

即默认启用fast-forward方式进行合并,不会显示 feature,只保留单条分支记录;

 

 

报错:

error: cannot update the ref 'refs/remotes/origin/xyz': unable to create directory for '.git/logs/refs/remotes/origin/xyz': No such file or directory
解决方法:

  • git gc --prune=now  to clean up your local repo
  •  
    If that doesn't work, you can also try to clean the remote with  git fetch --prune 
  •  
    If that still doesn't work you can try rm .git/logs/refs/remotes/origin/xyz 

 

posted @ 2020-10-09 16:41  basuny  阅读(643)  评论(0编辑  收藏  举报