If you are using pycharm or other IDE, you can easily checkout an older version of your source code, just by right-clicking on the revision you want. Unfortunately, it is not so obvious to go back to the master branch if you do not care about what you are clicking on. Logically, you may have done the same process to go back : right-click on the most recent revision : Bad idea ! By doing that, you will get a “Detached HEAD”. On pycharm you will see the Head tag with an exclamation mark. To solve the situation, there are 2 way :
On command line, just do this:
1 |
git checkout master |
Or, if you have changes that you want to keep, do this:
1 2 |
git checkout -b temp git checkout -B master temp |
On pycharm, instead of right-clicking on “checkout revision”, right-click on “Branch origin/master” then on checkout.