所以基本上无论出于何种原因,在将我的主分支与另一个分支合并并将master分支推送到github repo后,我的代码被<<<<<<< HEAD
填充
无论出于何种原因,即使在我编辑过许多提交的地方,所以我所做的是git reset --hard
到之前的提交,并且当我尝试将我的主分支推送到github repo时我修复了代码
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'my github repo'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
现在正在执行git pull
只会给我填充的代码<<<<<<HEAD
我不需要。
所以我找了一些解决方案,前面几个结果建议git push -f origin branch
,但当我这样做时,我得到了
error: src refspec branch does not match any.
error: failed to push some refs to my github repo
所以我现在应该怎么做,小伙子?
答案 0 :(得分:0)
git push github master
To git@github.com:Joey-project/project.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Joey-project/project.git'
经常是一个重新出现的错误。
我已经读过其中一个解决方案是使用以下命令的变体:
git fetch github; git merge github/master
我建议你也看一下Git non-fast-forward updates were rejected Merge the remote changes,它有很多额外的信息..
答案 1 :(得分:0)
自己找到了
git push origin HEAD --force
诀窍。