Long story short, I have a situation where egit allows unchanged files to be committed. If I commit, will this corrupt the git repository?
-
1Is it `git` or the user claiming the files are "unchanged"? – johnsyweb Jun 06 '11 at 03:22
-
1I'm pretty certain this question is relevant: http://stackoverflow.com/questions/3459448/how-do-i-stop-git-from-committing-unchanged-files – Stein G. Strindhaug Jun 06 '11 at 09:23
2 Answers
Unchanged files are always committed in git. Each commit is the entire tree of files along with a commit message. Unless you have a specific strange situation which is not adequately captured by the description "unchanged files" there will be no problem.

- 5,662
- 4
- 33
- 41
-
Would like to just add one thing: the files are stored only once. This is determined by their contents' hash. So there is no disk space that is inefficiently used. – Adam Dymitruk Jun 06 '11 at 04:50
To answer your questions specifically, git commit
commits those files in the index, including files that are unchanged from what is in the repository. There are several ways to include a file in the index (see the git-commit
man page).
Git commits files based upon their hash code; if it is unchanged (as would be the case if the files are truly unchanged), then nothing is stored. But in any event, whether or not a file is unchanged when committed, a git commit
will not corrupt the repository.

- 569
- 5
- 8