threads / discuss / 47012

Question about purge git history

Subject: Question about purge git history

## tl;dr

One message between Oct 24, 2017 and Oct 24, 2017.

replies: 0people: 1as markdown or json

Kai Zhang· Oct 24, 2017, 00:26 UTC · lore
Hi
I have a git repository on server side, and a client keep pulling this repository periodically. After a while this repository gets very big (even after git gc), and since history is not very important to us, a purge strategy is needed.
I did some research on internet, and found two methods are available to purge history on git repository:
1. Remove .git folder
    1. Remove .git folder
    2. Reinit repository
    3. Commit all existing files
2.  Create a new branch and remove existing branch
    1. git checkout --orphan latest_branch
    2. git add -A
    3. git commit -am "commit message"
    4. git branch -D master
    5. git branch -m master
    6. git reflog expire --expire=now --all
    7. git gc --prune=now
Here I have two questions:
1. What would happen if client pulling is executed concurrently with above 2 methods? Would client side repository gets corrupted?
2. Is there anyway to propagate purged repository to client side?
Thank you so much for your attention.

Best Regards, Kai

← back to recent threads