Is it possible to use git for tracking changes without storing them?

Issue

I have a big directory structure with lots of binary files (images) in it. I want to track which files were added/deleted/changed without actually storing the changes.
Is it possible to do using git?

Just to reiterate, I don’t care about the contents of the change, just want to register the fact that the file was added/deleted/changed.

Open to other suggestions besides git that work across Windows/Linux/macOS.

Solution

Inspired by @eftshift0 advice this is what I’m doing now (and it works well!)

  1. Exclude everything except my directory listing with .gitignore

     *
     !.gitignore
     !ls.txt
    
  2. Save list of files with modified dates into ls.txt (decided using date to track changes is enough for me for now, so not doing the checksum).

     find . -printf "%c %p\n" -iname "*.mov" -o -iname "*.jpg" -o -iname "*.mp4" > ls.txt
    
  3. Commit the listing

     git add ls.txt
     git commit -m "added some files"
    

PS Printing time with find actually can be quite slow (takes several minutes with my directory of about 10k files), so if you are tracking many files and you don’t care about the modified date, better take it out.
Could be just windows thing though (i’m using git bash on windows).

Answered By – GreenOak

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published