git——'fatal: cannot do a partial commit during a merge'

1. 针对——'fatal: cannot do a partial commit during a merge',按步骤执行如下命令:

1. git push //将本地的合并提交到远程代码库, 图中做了两次git push 是因为网络原因第一次没提交成功
2. git -add -A    //提交所有变化
3. git commit -m '注释'
4. git push

 

2.Git撤销add、commit

撤销add

git status 查看当下更新的文件
git reset HEAD 表示撤销上次add的所有文件
git reset HEAD dir/dir/test.php 撤销指定文件

撤销commit

git reset --soft HEAD^  //这样就成功的撤销了你上次的commit(仅仅是撤回commit操作,代码仍然保留)

 ( HEAD^的意思是上一个版本,也可以写成HEAD~1。如果你进行了2次commit,想都撤回,可以使用HEAD~2 )

3. Updates were rejected because the tip of your current branch is behind

使用强制push的方法:(还有其它办法,请自行百度!)
 git push -u origin 分支名 -f
这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。
原文地址:https://www.cnblogs.com/skzxc/p/12432967.html