0

I work at a shell script which commits automatically my last changes from my project to my local git repository. It works great so my next step is to optimize the script. Now I search for a command to delete the history of my repository except for the last 10 commits.

I only found commands to clean the whole history, that is not the solution I want. Maybe someone had an idea?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
  • 3
    What do you mean "optimize the script"? Why do you want to delete your history? – John Kugelman Nov 11 '19 at 14:10
  • Because I want to delete a lot of test commits and also I want to reduce the size of my repository. With every commit I save the database if something has change (the database isn't very large) – Jacqueline Isabelle Klein Nov 11 '19 at 14:18
  • 3
    Sounds like you need to learn how to rebase your commit history. Rebasing lets you clean up and prettify your history. – John Kugelman Nov 11 '19 at 14:25
  • 2
    Storing a database in Git is a bit of a red flag, though. Git is for code, not data. It might not be the right tool for whatever job you're having it do. – John Kugelman Nov 11 '19 at 14:27
  • Thanks I will look for rebasing. (I learned git only a few weeks ago). I read about the problem for data saving in git, but I don't find a better way at now. But that is another thematic :). Thanks for your answers. – Jacqueline Isabelle Klein Nov 11 '19 at 14:42

0 Answers0