0

I am learning React/Redux and started a new app with create-react-app . The problem I am having is that when i check git status it shows every file from the desktop as tracked and ready to be added then committed. Obviously this is not what I want but i'm not sure why this is happening and/or how to stop it. Any help will be greatly appreciated.

  • 1
    Possible duplicate of [Git tracking entire home directory. Get error - fatal: bad default revision 'HEAD'](https://stackoverflow.com/questions/18036754/git-tracking-entire-home-directory-get-error-fatal-bad-default-revision-hea) – phd May 14 '18 at 22:23

3 Answers3

1

It is happening because you may have the .git file in root directory.

  • remove .git file // command rm -rf .git
  • cd into your project root folder // conmand cd project
  • Iniciate git //command git init
  • add repository url where you want to push // command git remote add origin ‘your repo url’
  • now check status it should be fine
0

Run git reset HEAD to unstage all staged changes without undoing the changes in your working tree. After that, git status should show only unstaged changes.

Rory O'Kane
  • 29,210
  • 11
  • 96
  • 131
0

I solved the issue by simply initializing the repo from the command line. I'd been banging my head against that wall for about a year and may have found the solution. The process was, create-react-app 'appname', then cd into the app name directory, then git init once inside the directory. I then created a new repo on github and chose the appropriate option. I think it was push existing repo from command line. Anyway, maybe this will help someone else one day.

Useless Code
  • 12,123
  • 5
  • 35
  • 40