I accidentally modified the Git branch of my project in android studio

Asked

Viewed 46 times

0

Guys, I was working on my project when I accidentally clicked on something, and apparently I "lost" the newer versions. I appeared this message on my android console studio:

Warning: you are leaving 19 commits behind, not connected to
any of your branches:
  d78081a App cliente Versão 1.5.7
  9d19da0 App cliente Versão 1.5.6
  861890d App cliente Versão 1.5.5
  15ff813 App cliente Versão 1.5.4
 ... and 15 more.
If you want to keep them by creating a new branch, this may be a good time
to do so with:
 git branch <new-branch-name> d78081a
Switched to branch 'master'

And I don’t know what should be done

  • Which branch are you on? just check out the branch you want.

  • I ended up in a very old one, I didn’t know the checkout but I’ll read about, thank you very much!

1 answer

0


I was able to solve the problem, apparently when the versions fade into a history: Glue it to the terminal

git reflog

then you need to create a new branch and reference what is missing

git branch new-branch ba5a739

where the new-branch is the branch name and the number on the side is the reference number

and then you return the code to the old branch with the following code:

git reset --hard ba5a739

and then all the code will go back to normal

Browser other questions tagged

You are not signed in. Login or sign up in order to post.