If I am understanding the answers here correctly, git should not track an empty directory, but should not delete it locally. This is not the behavior I am experiencing.
Directory dir_foo/ exists on two computers, A and B. It is full of tracked files. On computer A, my program deletes all of the files in dir_foo/, but leaves the directory intact. I then add/commit/push the changes. On computer B, after pulling, I see that not only are all the files deleted, but dir_foo/ has been deleted locally as well on computer B! (Note that it still exists on computer A.) I think this behavior is incredibly counterintuitive. I do not want this behavior, and, for my use case, cannot specify every directory that git should not delete.
Why is this happening? How can I stop this behavior (without having to specify every empty directory that git should not delete)? Why does the behavior I am experiencing contradict the info in the link above? Thank you.
Reading past this point is not required to answer the question. The info below was requested in the comments.
Screenshots (identifying info removed):
The troublesome directory is results/. The first two screenshots show computers A and B, with the directory and a test file inside:
Next, we remove the file on computer A, leaving the directory intact, commit/push, and observe that the directory is still locally intact on A:
Finally, we pull on computer B, and observe that the directory has (again) been deleted locally:
Also, computer B is a cluster (I have little control/no sudo access). Perhaps they have some weird non-standard version of git or git settings on the cluster?
.gitignore contents:
$ cat .gitignore
results.jld2
safe_to_graph
[redacted]_exit_results/
Environments/Recommender_Env/MSLR-WEB10K/*
!Environments/Recommender_Env/MSLR-WEB10K/csv_converter.py
!Environments/Recommender_Env/MSLR-WEB10K/pickle_file_checker.py
!Environments/Recommender_Env/MSLR-WEB10K/Fold1/
Environments/Recommender_Env/MSLR-WEB10K/Fold1/*
!Environments/Recommender_Env/MSLR-WEB10K/Fold1/vali_pickle
# Environments/Recommender_Env/Microsoft_Data_Set/.idea/
IJCAI_Async_Rec_results/
async_results/*
swarm_logs/*
zipresults/*
Environments/Recommender_Env/MQ2008/*
!Environments/Recommender_Env/MQ2008/csv_converter_MQ.py
!Environments/Recommender_Env/MQ2008/pickle_file_checker_MQ.py
!Environments/Recommender_Env/MQ2008/Fold1/
Environments/Recommender_Env/MQ2008/Fold1/*
!Environments/Recommender_Env/MQ2008/Fold1/vali_pickle
MUJOCO_LOG.TXT



