Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Github, how can you tell if a directory has been removed?

Tags:

git

github

Given a directory /fruits with files apple.js, banana.js and orange.js is there an indicator to distinguish between these two pull requests

  1. Directory /fruits has files apple.js, banana.js and orange.js removed
  2. Directory /fruits is deleted along with apple.js, banana.js orange.js
  3. file files apple.js, banana.js, and orange.js have their content completely wiped but the file remains (empty file)

I'm currently looking at a PR where the directory was was removed along with its contents but in my experience it looks identical to a PR where the files contents would have been removed.

like image 1000
Tyler Pham Avatar asked Sep 20 '25 21:09

Tyler Pham


1 Answers

In Git, you cannot commit empty folders, because Git does not actually save folders, only files. Therefore removing all files in a directory will effectively "delete" it from your repository. This means that your examples 1. and 2. are identical.

Example 3. will be different: a file with only its contents deleted will show you a diff of all deleted lines, but a deleted file would show you a message: "This file was deleted", it looks like this:

Message "This file was deleted"

like image 111
PhilipRoman Avatar answered Sep 22 '25 14:09

PhilipRoman