What commit type should I use when I'm deleting files from a repo?
I have seen several types over the internet, but none talk about file deletions. Possibly the closest options that come to mind are CHORE and REFACTOR.
EDIT 1 : START
Reasons why I'm confused is because none of the definitions for CHORE and REFACTOR talk about file deletions.
Internet gives below definitions,
CHORE:
chore: (updating grunt tasks etc; no production code change).
This SO post throws some more light on its possible usages.
REFACTOR
refactor: A code change that neither fixes a bug nor adds a feature
As per this SO post file deletions don't come under Refactoring.
I believe the descriptions of REFACTOR
need to be improved in the documentations. Deletion is such a common thing that I would expect it to be there in the definitions of REFACTOR
ing.
I might be overthinking. I just want to do what is right.
EDIT 1 : END
1 Answer 1
This relates to https://www.conventionalcommits.org/en/v1.0.0/ ?
The semantics are supposed to describe why rather than what. So it depends why you're deleting the files.
-
This is a good start, but can you elaborate on your last sentence?Greg Burghardt– Greg Burghardt2021年06月16日 16:44:56 +00:00Commented Jun 16, 2021 at 16:44
-
@pjc50 That site is one of the many that I referred to. I get your point of WHY i.e. the intent behind the file deletion. In my case I had added few files during development but then moments later discovered that they were not required and hence deleted them. These files are present in last two commits. So from the Angular convention referred in that doc
refactor: A code change that neither fixes a bug nor adds a feature
, it appears REFACTOR should be used. But then again its not a code change; its complete removal of the files themselves. And this why its confusing.Asif Kamran Malick– Asif Kamran Malick2021年06月16日 17:02:00 +00:00Commented Jun 16, 2021 at 17:02 -
3You're overthinking this. One of the major achievements of Git is to make renaming, moving, deleting etc. of files as transparent as editing of file contents. Don't complicate things by re-introducing an artificial distinction between the two. Removing files from a directory should be treated exactly like removing lines from a file.Kilian Foth– Kilian Foth2021年06月16日 19:59:39 +00:00Commented Jun 16, 2021 at 19:59
-
I might be overthinking. I just wanted to do what is right.Asif Kamran Malick– Asif Kamran Malick2021年06月17日 03:31:53 +00:00Commented Jun 17, 2021 at 3:31
-
I believe the descriptions of
REFACTOR
need to be improved in the documentations. Deletion is such a common thing that I would expect it to be there in the definitions ofREFACTORing
. As per this SO post file deletions don't come under Refactoring. Why then do you suggest it's same as removing lines of code. To the downvoters: care to explainwhy
?Asif Kamran Malick– Asif Kamran Malick2021年06月17日 03:46:36 +00:00Commented Jun 17, 2021 at 3:46