2

Long story short, I have a situation where egit allows unchanged files to be committed. If I commit, will this corrupt the git repository?

Ken Hirakawa
  • 7,831
  • 10
  • 38
  • 49

2 Answers2

4

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.

Anonymoose
  • 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
0

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.

Jon Spencer
  • 569
  • 5
  • 8