-2

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 REFACTORing.

I might be overthinking. I just want to do what is right.

EDIT 1 : END

1 Answer 1

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.

12
  • This is a good start, but can you elaborate on your last sentence? 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. Jun 16, 2021 at 17:02
  • 3
    You'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. Jun 16, 2021 at 19:59
  • I might be overthinking. I just wanted to do what is right. 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 of REFACTORing. 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 explain why? Jun 17, 2021 at 3:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.