S
S
Spaceoddity2021-08-25 19:20:59
git
Spaceoddity, 2021-08-25 19:20:59

How to clean up .git folder (from local and remote repository)?

They are growing. And I don't need rollbacks, because these are just github pages.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Kuznetsov, 2021-09-02
@Spaceoddity

If you just need to delete the old history, then this can be done quickly and safely with just a couple of commands.
The first command will collapse the entire history of the branch into a single commit:

git reset $(git commit-tree HEAD^{tree} -m 'Новое начало истории')

The second command will clean up the .git folder from garbage:
git gc --prune=now --aggressive
And of course push the new state of the branch to github:
git push --force
If you have Windows, then work in git-bash, not in the standard command line.

V
Vladislav Lyskov, 2021-08-25
@Vlatqa

Select the folder and press the delete button on the keyboard

N
Nikolai Sokolov, 2021-08-25
@NikS42

Nothing from remote. You can merge the branch into the master with squash, but when the purge happens, it depends on the service. The local one can be cut out by creating a new one, and the history can be rewritten with garbage cleaning. And then pour on a new remote

A
Andy_U, 2021-08-26
@Andy_U

see www.stackoverflow.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question