I use a git repository as a temporal storage. I add some directory, push it to remote repo, some time later, on another machine I clone repo, use directory data and after this moment I don't need it anymore. So, my commit history looks like this :
commit dddddddddddddddddddddddddddddddddddddddd
Add folder D
commit cccccccccccccccccccccccccccccccccccccccc
Add folder C
commit bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Add folder B
commit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Add folder A
And directories :
.
├── A
├── B
├── C
├── D
└── README.md
I don't change data in this directories once I pushed them to the repo. I repeat an operation of adding a folder to my repo very often what makes repository to grow very fast.
As a solution I would like to delete a folder, that I don't need. Let it be a directory C
. Every folder has only one commit in its commit history (For the directory C
it will be commit cccc...
). I can delete this folder, commit changes but in .git/objects
data from C
will remain, but I don't need it. That's why I would like to delete commit cccc...
. I can't use git revert
because it just replaces for me processes of deletion and submission.
What I want is to completely get rid of data in folder C and from commit cccc...
. There is an option : git rebase -i <commit>~
. But it opens an interactive mode to edit history, while I want a command way of a commit deletion, so I can add a script that deletes not-needed data once I finish my work with it.
What are your the solutions for a current problem?