1

i ran into a typical situation. I already have a cloned repo in my local. and i have a path /src/main/resources

my goal was to create a directory inside resources and name it scripts and add some files into that folder. what i did was i created a folder and copied the files but when adding these items to github i added only the files and forgot to add the folders. i created myself a pull request and merged it to develop.

now this whole set of files are not visible in the remote repo. also in local if i now go to src/main/resources/scripts and do git add . nothing is happening.

please help me how to recover from this situation.

satish chennupati
  • 2,331
  • 1
  • 13
  • 25

2 Answers2

2

You don't add folders with Git, only files (which are in folders).

Check first how many .git subfolder you have:

cd /path/to/local/repo
find . -type d -name ".git"

That will detect if you have any nested repository.

And do a git status in /src, and /src/main/resources (assuming here that /src means actually /path/to/local/repository/src)

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
0

Empty directories or folders cannot be committed. That is why the empty directory you created was not visible in the remote.

You should either add a .gitignore or a .gitkeep inside the empty directory to be able to commit and view that in the remote.

How can I add an empty directory to a Git repository?