I understand that storage history is something that is better to keep for vcs and I know that git allows to clone not the full history log but:
- I afraid GitHub space is limited (main reason)
- it’s auto-commits processing by script
- I’m interesting only in last 10 or 5 commits in history
- server space could be limited
Yet I can’t fully form the idea why do I want it but I shell try: I want to fork this (automated) repository and use git merge (yes, as a tool) to work on it and keep myself update with upstream. So in this case I will use git right. ideally I must make what “git merge” makes without having this automated upstream repository but it’s another task.
For now I found only that tricky way to clean all the history using git rebase
git checkout --orphan temp $1
git commit -m "Truncated history"
git rebase --onto temp $1 origin/master
git checkout master
git branch -D temp
But that is as complex as useless, it’s easier to create new repository and push files directly there. So need something to keep git repository history small.
What you do is very wrong.
A VCS helps you keep the history of your code, merge the work of the coder(s), manage branchs, retrieve old versions, find the origins of a bug, test a new strategy, and so on. It’s useful in backuping your code too but that’s far from its sole function.
You just seem to be interested in git as a tool to save your recent work. That’s not at all what git is dedicated to.
And your arguments aren’t valid. If you store only your code (and parameterization and small resources) in git, you won’t risk exploding github storage space nor any kind of server space. I have many projects on git, with many coders, and the occupied space is negligible. You shouldn’t try to erase history just to save space.
If you’re coding, use git normally, respect its best practice, you won’t regret it as it is a very valuable tool.