4

I have a lots of modified files in a git repo.

I need to prune the ones where there is no change, where only the timestamp has changed. Due to the amount of files it would take me a loong time to do that manually.

Is there some smart way to do that?

Invariant
  • 185
  • 1
  • 11

1 Answers1

5

A timestamp change alone should not register in a git status.

That means a git add would only add files with actual changes.

Maybe the file permissions have changed though.

This is more likely to be related to an automatic eol conversion (end of line)

Since Git 2.8, you can quickly check that with:

git ls-files --eol
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It does however. And git gui says: "The modification data of this file has been changed by another application, but the content within was not changed." – Invariant Oct 15 '16 at 07:02
  • @Invariant37 what git status return? – VonC Oct 15 '16 at 07:03
  • Git status also shows those files with only modified modification date. – Invariant Oct 15 '16 at 07:03
  • @Invariant37 is there a message returned by git status which indicates that only the timestamp has changed? – VonC Oct 15 '16 at 07:04
  • No, it just list those files among the files which content actually was changed. – Invariant Oct 15 '16 at 07:06
  • @Invariant37 OK. See my edited answer (which refers now to http://stackoverflow.com/q/5787937/6309) and check (if you have Git 2.8 or more) the result of `git ls-files --eol` (as I detail in http://stackoverflow.com/a/35204436/6309) – VonC Oct 15 '16 at 07:08
  • @Invariant37 Then try and clone again your repo after a `git config --global core.autocrlf false`. See if you have as many files listed by a git status then. – VonC Oct 15 '16 at 07:14
  • @Invariant37 Great! Don't forget to read http://stackoverflow.com/help/accepted-answer and http://stackoverflow.com/help/why-vote – VonC Oct 15 '16 at 09:35