Git Detached Head in Android Studio

60 views Asked by At

I am using Git with Flutter and recently I noted that doing a commit I get the message about a Detached Head. I would like to remove the detached head situation.

This was probably generated by the fact that I moved back from version 6.3.1 non-nullable that created some coding issues to a previous "nullable" version.

Then I did some modifications and some commits.

Now I would keep the current version (6.5.0) merging back and removing the detached head status but without going again in the non-nullable version 6.3.1.

How can I do (I use the user interface of Git for Android Studio)?

enter image description here

enter image description here

1

There are 1 answers

2
Kaushik Chandru On

You may try

git checkout <branch name> 

Or

git checkout -

But you may lose your work. You can try

git checkout -b newbranch

And merge it to the master and use the master branch