git connflit 解决办法


1. 切换到本地master 分支, git fetch https://github.com/ceph/ceph master:temp (新建一个temp分支,包含最新的代码)

2. git rebase temp (本地master 分支已经是最新代码)

3. 切换到工作分支, 执行git rebase master

4. 可能出现冲突

解决办法: 进入冲突文件, 把冲突部分的标志修改完.

5. git add 冲突文件

6. git commit --amend

7 git push origin EAS-liftcycle -f

这一步加上-f 的原因:

To https://github.com/dengxiafubi/ceph.git
 ! [rejected]        EAS-liftcycle -> EAS-liftcycle (non-fast-forward)
error: failed to push some refs to 'https://github.com/dengxiafubi/ceph.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

有如下几种解决方法

(1) 使用强制push的方法:

$ git push -u origin master -f

这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。

(2) push前先将远程repository修改pull下来

$ git pull origin master

$ git push -u origin master

(3) 若不想merge远程和本地修改,可以先创建新的分支:

$ git branch [name]

然后push

$ git push -u origin [name]




猜你喜欢

转载自blog.csdn.net/dengxiafubi/article/details/77837736