Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Git Maintenance Commands
# Verifies the connectivity and validity of the objects in the database
git fsck —unreachable
# Manage reflog information
git reflog expire —expire=0 —all
# Pack unpacked objects in a repository
git repack -a -d -l
# Prune all unreachable objects from the object database
git prune
# Cleanup unnecessary files and optimize the local repository
git gc —aggressive
@tgkprog

This comment has been minimized.

Copy link

@tgkprog tgkprog commented May 23, 2016

git gc --aggressive
Two -

@sammcj

This comment has been minimized.

Copy link

@sammcj sammcj commented Jul 2, 2018

Also if you copy paste the above commands they copy with incorrect -'s.

# Verifies the connectivity and validity of the objects in the database
git fsck --full

# Manage reflog information
git reflog expire ---expire=now --all

# Pack unpacked objects in a repository
git repack -a -d -l 

# Cleanup unnecessary files and optimize the local repository and prune all unreachable objects from the object database
git gc --prune=now --aggressive
@Atrejoe

This comment has been minimized.

Copy link

@Atrejoe Atrejoe commented Jul 31, 2018

# Verifies the connectivity and validity of the objects in the database
git fsck --full

# Manage reflog information
git reflog expire --expire=now --all

# Pack unpacked objects in a repository
git repack -a -d -l 

# Cleanup unnecessary files and optimize the local repository and prune all unreachable objects from the object database
git gc --prune=now --aggressive

(expire=now had one hyphen too much)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment