After git checkout returns to the previous version, how do I push the code written in the previous version?

  git, question


Some files in git were deleted because other project personnel mistakenly operated at noon. Therefore, only the morning version can be checked out.

Now I want to push up the code I wrote today, but I always remind this. Is the git project still in the state of being deleted by mistake?

What can I do now to push the latest code?

Thank you ~

Save your changes

git commit …
git tag tmp

Update main 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


git tag -d tmp