Git push rejected “non-fast-forward”

后端 未结 12 1483
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 02:01

I am fairly new to git yet currently using it to manage our code in a team environment. I had some rebasing issues and I fixed them using

git ch         


        
相关标签:
12条回答
  • 2020-11-30 02:46

    try this command

    $ git push -f -u origin <name of branch>

    i.e $ git push -f -u origin master

    0 讨论(0)
  • 2020-11-30 02:49

    I had a similar problem and I resolved it with: git pull origin

    0 讨论(0)
  • 2020-11-30 02:53

    It looks, that someone pushed new commits between your last git fetch and git push. In this case you need to repeat your steps and rebase my_feature_branch one more time.

    git fetch
    git rebase feature/my_feature_branch
    git push origin feature/my_feature_branch
    

    After the git fetch I recommend to examine situation with gitk --all.

    0 讨论(0)
  • 2020-11-30 02:56

    I had this problem! I tried: git fetch + git merge, but dont resolved! I tried: git pull, and also dont resolved

    Then I tried this and resolved my problem (is similar of answer of Engineer):

    git fetch origin master:tmp
    git rebase tmp
    git push origin HEAD:master
    git branch -D tmp
    
    0 讨论(0)
  • 2020-11-30 02:57

    Here is another solution to resolve this issue

    >git pull
    >git commit -m "any meaning full message"
    >git push
    
    0 讨论(0)
  • 2020-11-30 02:58

    Well I used the advice here and it screwed me as it merged my local code directly to master. .... so take it all with a grain of salt. My coworker said the following helped resolve the issue, needed to repoint my branch.

     git branch --set-upstream-to=origin/feature/my-current-branch feature/my-current-branch
    
    0 讨论(0)
提交回复
热议问题