-1

Everything worked fine unit today.

Symantec/Antivir scanned and restarted my computer and afterwards my workspace looked like this.

Does anyone know what I can do?
How can I set the HEAD once a again? In local the paths are all removed.

Problem

enter image description here enter image description here

quma
  • 5,233
  • 26
  • 80
  • 146
  • I had to checkout the project again and afterwards I copied the .git folder into the original project - afterwards everything worked fine. – quma Mar 17 '16 at 14:18

1 Answers1

1

You can always clone the project again to get the latest code from the repository.

Another option is to execute fsck and recover from dangling files.

# Search for all uncommitted added files = dangling content
git fsck --full

# print out the content of the dangling content
git show <SHA-1>

If the content is commited simply use git reflog

More info in more detailed can be found here:
How to move HEAD back to a previous location? (Detached head)


A single line command, breached into multiple lines only for readability

# You can try recovering a branch by resting your branch to the sha
# of the commit found using a command like: 
git fsck --full --no-reflogs --unreachable --lost-found | 
    grep commit | cut -d\  -f3 | xargs -n 1 
    git log -n 1 --pretty=oneline > .git/lost-found.txt

# Display the above commits 
git log -p <commit>

# OR: 
git cat-file -p <commit>
Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167