Cannot push to GitHub - keeps saying need merge

后端 未结 30 2303
天命终不由人
天命终不由人 2020-11-22 00:09

I\'m new to GitHub. Today I met some issue when I was trying to push my code to GitHub.

Pushing to git@github.com:519ebayproject/519ebayproject.git
To git@gi         


        
30条回答
  •  囚心锁ツ
    2020-11-22 01:01

    This normally happens when you git commit and try to git push changes before git pulling on that branch x where someone else has already made changes.

    The normal flow would be as below,

    STEP 1: git stash your local uncommitted changes on that branch.

    STEP 2: git pull origin branch_name -v to pull and merge to locally committed changes on that branch (give this merge some message, and fix conflicts if any.)

    STEP 3: git stash pop the stashed changes (Then you can make commits on popped files if you want or push already committed changes (STEP4) first and make new commit to files later.)

    STEP 4: git push origin branch_name -v the merged changes.

    Replace branch_name with master (for master branch).

提交回复
热议问题