0

Was testing some old commits in a detached HEAD state. When I checkout out my latest commit, I saw the following ~HEAD tag next to a file (git status).

Davids-MacBook-Air:android david$ git status
On branch random_video
Untracked files:
(use "git add <file>..." to include in what will be committed)

app/src/main/java/com/myApp/android/Models/VideoMetadata.java~HEAD
app/src/main/res/drawable/lobbytab_random.xml

nothing added to commit but untracked files present (use "git add" to track)

How is it possible for the HEAD to be on a specific file - isn't it a pointer to the state of code at a specific point in time?

David Ferris
  • 2,215
  • 6
  • 28
  • 53

1 Answers1

0

How is it possible for the HEAD to be on a specific file - isn't it a pointer to the state of code at a specific point in time?

Exactly. You have the full picture what is head.
Head is pointer to the current commit in your repo.

Here you can read more about it and how to "move" the HEAD.
How to move HEAD back to a previous location? (Detached head)

In your case the ~HEAD is leftovers from a merge you did somewhere on the way.

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167