git commands

This commit is contained in:
Nemo 2019-06-13 15:00:48 +05:30
parent 8b8f0f83d0
commit fa357e64a0
3 changed files with 20 additions and 0 deletions

4
git-pushall-branches Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do
git branch --track "${branch##*/}" "$branch"
done

16
gitlistobjectbysize.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash -e
# work over each commit and append all files in tree to $tempFile
tempFile=$(mktemp)
IFS=$'\n'
for commitSHA1 in $(git rev-list --all); do
git ls-tree -r --long "$commitSHA1" >>"$tempFile"
done
# sort files by SHA1, de-dupe list and finally re-sort by filesize
sort --key 3 "$tempFile" | \
uniq | \
sort --key 4 --numeric-sort --reverse
# remove temp file
rm "$tempFile"