1

I have written a simple script to git commit the changes every hour and push the changes But I want to keep only the last commit of each day and remove the previous ones due to the size of commits to save the space. In other words, I need to keep the last commit of 22nd December and remove the previous ones but keep the last commit of the previous day and it should not be deleted. This is the same for the next days.

1 Answers1

1

If your process creates a commit every hour, you can reset the past 23 commits every day and create a single commit:

git reset --soft HEAD~23 && \
git commit -m "Squashed previous 23 commits into one" && \
git push origin
Saravana
  • 37,852
  • 18
  • 100
  • 108