Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

Git checkout HEAD- switching back to HEAD

Asked by Faith Davidson Jul 17, 2021 2.4K views 1 answer
Share

About this question

 I've been doing my project while at some point I discovered that one thing stopped working. I needed to look up the state of my code when it was working correctly, so I've decided to use git checkout (because I wanted to check-something-out). And so I've done

git checkout SHA

a couple of times while going back to the point from which I can't go to HEAD, the output is the following:

git checkout SHA-HEAD
error: Your local changes to the following files would be overwritten by checkout:
    [list of files]
Please, commit your changes or stash them before you can switch branches.
Aborting

I am pretty much sure I have NOT changed anything. The command

git checkout master

gives the same output.

Is there a way to go back to HEAD?

What is the safe way of "jumping over" history commits?

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.