search

Home  >  Q&A  >  body text

github - After git checkout returns to the previous version, how to push the code written in the old version?

Due to misoperation by other project staff at noon, some files in git were deleted. So I can only checkout and go back to the morning version.

Now I want to push the code I wrote today, but I keep getting this prompt. Is the git project still in the state of being accidentally deleted?

What should I do now to push the latest code?

Thank you~

迷茫迷茫2812 days ago750

reply all(2)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:27:54

    Save your changes

    git commit...
    git tag tmp

    Update master branch to remote latest

    git checkout master
    git pull origin master

    Merge your changes and submit to remote

    git merge tmp
    git push origin master

    clean

    git tag -d tmp

    DONE

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-02 09:27:54

    You first save your current points, then switch to the local master, then merge your points to the local master, and then pull the remote master. There should be a conflict at this time, because the remote is missing some things you have locally. Resolve the conflict and then upload your local master to the remote one

    reply
    0
  • Cancelreply