I just jumped back into a project that I've been using Git on for about 6 months and saw this:
$ cd /d/DEVELOP/BlenderAe # My repo root
$ git status
fatal: not a git repository (or any of the parent directories): .git
That's definitely the right path, why does git not recognise my local clone?
My last actions were:
- create local branch
- work on local branch (switched to local branch in VSCode... culprit?)...
- saved but not pushed to remote (I'll never miss this step again! Argh!).
The git folder contents are as follows:
$ cd /d/DEVELOP/BlenderAe # My repo root
$ ls .git
ORIG_HEAD objects/ refs/
I do have the current code (backed it up, outside of git). How do I reconnect? And also to my github remote?
After fixing ORIG_HEAD
I see:
$ git status
Not currently on any branch.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
deleted: (old_file1).py
...all the older files that were previously renamed/deleted are listed here for deletion.
Untracked files:
(use "git add <file>..." to include in what will be committed)
Current_file1.py
...all the current files are listed here as untracked.
pwd
andgit status
in the git shell (including the shell prompt) and maybe a screenshot of the folder in Explorer?pwd
should return correct path. Is it a multi-module project? If you want to reconnect, just check you have correct remotes configured by runninggit remote -v
. If remote is not set or missing, try adding the remote first./d/DEVELOP/BlenderAe
git status -...MINGW64 /d/DEVELOP/BlenderAe $ git status fatal: not a git repository (or any of the parent directories): .git
ls .git; git status
. please do not answer requests for info with a comment.My current plan is
you can, for sure do that . It is worth IMO using the situation as a learning experience - one you get confidence recovering from any kind of 'git disaster' - the next time it's just not a problem.