It looks like you have .git
folder in the wrong place. You can rename it to anything not .git
– it won't have any effect on other files. If you still need it, you can rename it back:
mv .git _.git_backup
If you made a mistake, the operation is reversible:
mv _.git_backup .git
If you have the .git
directory in the wrong location and already worked on it, it is best to move it somewhere else to prevent any accidents (switching branches, losing worktree changes, etc.).
Create a new empty folder somewhere on your computer, e.g. /tmp/recovery
and copy your .git
folder there. Then switch to the directory and perform a git status
. Does its output match your expectations? It probably will tell you about lots of "deleted in the worktree" files. If that's the case, do git checkout HEAD -- .
in your new empty directory.
This will restore the files that are tracked in the Git repository. Check again your directory to match your expectations. Maybe you can manage to go from there. If not, let us know which files are available in the new directory and what you expect instead (edit your question and add this information to it).
In the end, rename the original .git
directory in your home folder (rename, not remove. renaming allows you to undo the operation).