0

Here is what I did

git status
git add .
git commit - m "message"
git checkout branchName
git push origin branchName

then message comes with Everything is up to date but My old code is gone. please help me thanks

  • 2
    It seems you commit your code in a branch and then checkout and push another branch. you should know which branch when you run git commit and push that branch to remote – Chen Liu Apr 04 '22 at 05:33
  • 2
    You changes bransch after committing. Change back to whatwvwr bransch you were on before and you'll find your code. – fredrik Apr 04 '22 at 05:35
  • I hate typing on phones :/ never notice the mistakes until much later. – fredrik Apr 04 '22 at 06:10
  • https://git-scm.com/docs/git-reflog is your friend. It will tell you what you did exactly and where your changes are. Git has its own versioning system under the hood for you to be able to go back and revert your commands, but also just simply see what you did. – Dmitry Apr 04 '22 at 19:47

0 Answers0