My folder is not tracked by git

I have a folder FBA_Matting, i originally cloned the repo in the existing git repo and due to which i was unable to commit the folder.

So i deleted the FBA_Matting/.git but unfortunately the folder was not committed.

Then on my other PC, there was git repo containing all the code of FBA_Matting with some changes, So to avoid fatal: refusing to merge unrelated histories

So i copied the folder and pasted into my repository (checkout new branch, added FBA_Matting). Now I can’t see my folder back in git status command. So i tried to change the name from FBA_Matting to FBAMatting and now i can see it in git status

PS: I checked .gitignore Also, and there as no file containing FBA_Matting entry

Hi @tbhaxor

Are you still having trouble tracking that folder in Git?
How did you add the folder? Please give steps.

Was it added locally in your file directory? Or was it uploaded to the GitHub UI?
Please list all the git commands used to get to the point where you are now.
This will help the community reproduce what you are experiencing.

Not actually, I just want to know this

In git repo folder i cloned another git repo (FBA_Matting). All the folders we committed but not FBA_Matting. Then later on when i removed .git folder from FBA_Matting, the contents in folder was lost. There are empty folder committed.

The problem is Git never commit empty folder. How can i retrieve my files of FBA_Matting.

You can check your logs to go back to a previous point in time.
The following steps assume you deleted the contents and then made commits after.
To find the right commit, first check the history for the deleted file:

$ git log -- <filename>

You can either work with the last commit that still had the file, or the commit that deleted the file. In the first case, just checkout the file from that commit:

$ git checkout <commit hash> -- <filename>

In the second case, checkout the file from one commit before that:

$ git checkout <deletion commit hash>~1 -- <filename>

If the file was never actually committed this of course will not be in the history.

You mentioned:

Then on my other PC, there was git repo containing all the code of FBA_Matting with some changes, So to avoid fatal: refusing to merge unrelated histories

With the folder added this changes the history, so you will need to address the differences between the files and fix the merge conflicts.

Use :
$ git pull origin [repo] --allow-unrelated-histories