Skip to content

Commit 9c97a6d

Browse files
committed
New EasyKey.git function to reduce repo size
1 parent 48ab73b commit 9c97a6d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

EasyKey.git/ezk-git-functions.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,3 +366,15 @@ diffDrillDownAdvanced () {
366366
done
367367
fi
368368
}
369+
370+
repoSize() {
371+
executeCommand "git gc"
372+
executeCommand "git count-objects -vH"
373+
executeCommand "git rev-list --objects --all | grep -f <(git verify-pack -v .git/objects/pack/*.idx| sort -k 3 -n | cut -f 1 -d ' ' | tail -10)"
374+
echo "Enter file pattern to REMOVE in repo history:"
375+
read filePattern
376+
[ "${filename}" = "" ] && waitonexit && return
377+
executeCommand "git filter-repo --path-glob '"${filePattern}"' --invert-paths --force"
378+
executeCommand "git gc"
379+
executeCommand "git count-objects -vH"
380+
}

EasyKey.git/git.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ menuItem r "Show branch history" showBranchHisto
3030
echo
3131
submenuHead "Other usefull actions:"
3232
menuItemClm s "Working with diffs" workingDiffs w "Atlassian's view" atlassiansView
33-
menuItem c "Change last commit message" "git commit --amend"
33+
menuItemClm c "Change last commit message" "git commit --amend" x "Descrease repo size" repoSize
3434
echo
3535
submenuHead "Git admin actions:"
3636
menuItemClm 1 "Show local git config" localGitConfig 2 "Show global git config" globalGitConfig

0 commit comments

Comments
 (0)