1

I'm using a private GitHub repo as a backup for some notes I'm taking, and I have a script setup to automatically make commits and push them every 10 minutes while I'm working, if any changes are detected. Since I tend to be writing notes for 1-2 hours a day, after a week I'll have somewhere between 50-90 commits, and I don't want/need my commit history to be that numerous.

I came across this post and saw its most upvoted answer:

git reset --soft HEAD~3 &&
git commit

This is really close to what I need, but I want to target the commit 7 (or N) days ago rather than pick some N number of commits ago. Could anyone point me in the right direction?

ROODAY
  • 756
  • 1
  • 6
  • 23
  • 1
    "is there a way in git to target the commit 7 days ago" Yes, there is. For instance `HEAD@{7.days.ago}` – matt Jan 28 '22 at 07:29
  • @matt beautiful, thanks! I'll work on putting together a script and answer this question with it when I'm done. – ROODAY Jan 28 '22 at 07:38
  • 1
    You can omit the dots and use spaces instead. Git is astoundingly forgiving about date specifications. Documentation is however very poor. See my question https://stackoverflow.com/questions/60800735/git-date-specification-formats-documentation – matt Jan 28 '22 at 08:06

0 Answers0