Reputation: 1
I am a newbie to all this and currently taking a class to learn git. However, I was in the process of practicing branching and merging. I had created a new branch and it was switched but my computer started to have issues, which cause me to shut it down and restart. When I return to my work, I returned to this:
>git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what
.gitconfig
AppData/
Contacts/
Creative Cloud Files/
Desktop/
Documents/
Downloads/
Favorites/
Links/
Music/
NTUSER.DAT{9f037fb3-2982-11e3-93f1-b8c
NTUSER.DAT{9f037fb3-2982-11e3-93f1-b8c00000001.regtrans-ms
NTUSER.DAT{9f037fb3-2982-11e3-93f1-b8c00000002.regtrans-ms
ntuser.dat{290469cc-4e2a-11e3-bebb-68500000002.regtrans-ms
I have no idea of what ntuser.dat means and when I run git fsck my return looks like this:
notice: HEAD points to an unborn branch (master) Checking object directories: 100% (256/256), done. notice: No default references
When I doing git log, I receive the fatal bad error. I have tried to reset and nothing seems to be working. Can someone please provide me with assistance?
Additionally, I am using a PC, which requires me to use the command prompt for Windows.
Upvotes: 0
Views: 3644
Reputation: 164639
It looks like this happened...
git init
in C:\Users\Sandy
.What you're seeing right now is a Git repository with no commits and a master branch that points to nothing. That's normal after you've created a repository. Here, I can recreate it right now.
$ mkdir foo
$ cd foo
$ git init
Initialized empty Git repository in /Users/schwern/tmp/foo/.git/
$ git log
fatal: bad default revision 'HEAD'
$ git status
On branch master
Initial commit
nothing to commit (create/copy files and use "git add" to track)
$ git fsck
notice: HEAD points to an unborn branch (master)
Checking object directories: 100% (256/256), done.
notice: No default references
All you need to do to fix this is git add
and git commit
something and proceed as normal.
As for why you're seeing all that junk in git status
, Git repositories cover a directory and all subdirectories. If you ran git init
in C:\Users\Sandy
then the repository will try to track everything in your home directory and all subdirectories. NTUSER.dat is normal Windows administrative files that Windows normally hides from you. Git doesn't care what a file is and shows you everything.
You probably don't want to put your entire home directory in version control. Not that it would hurt anything, it's just not practical. Instead, do as I did and create a new directory and run git init
there.
As for your repository in the home directory, just delete it. A Git repository is stored in a .git
sub-directory immediately inside your project directory. Delete C:\Users\Sandy\.git\
and you're done. In my example above, it would be foo/.git/
.
PS You can't run git init
on a file, it has to be in a directory.
Upvotes: 1