0

I have an org file where I ended up git committing on every save. This has resulted in a very large .git directory which is understandable, but it is not the right granularity for my purposes.

$ git count-objects -vH
..
count: 27393
size: 51.66 GiB

Is it possible to go back through my commits and automatically coalesce commits made on the same day, week or something similar so that I can look see when changes happen without wasting space on multiple commits a day?

Iceland_jack
  • 6,848
  • 7
  • 37
  • 46
  • 2
    What is your biggest problem? The repo size or "the right granularity"? If it's the repo size, [the Linux kernel has tens of thousands of commits but is sized less than 5GB](https://github.blog/2018-03-05-measuring-the-many-sizes-of-a-git-repository/). Usually [a big repo is caused by committing large files](https://stackoverflow.com/q/10622179/9157799), not number of commits. – M Imam Pratama Jan 30 '22 at 19:46
  • 2
    @MImamPratama I agree with your question. Note the [linux kernel](https://github.com/torvalds/linux) is now over one million commits and is about 3.5 GB in size. – TTT Jan 30 '22 at 20:28

1 Answers1

1

Maybe you can try something like this:

git reset --soft $(git rev-list -n 1 --before="yesterday" HEAD) && git commit -m 'daily commit'

this will make a single comit of everything that was comitted since yesterday. Doing so every morning may do the trick.

OznOg
  • 4,440
  • 2
  • 26
  • 35