Last active
July 10, 2018 13:04
-
-
Save AlwxSin/c50bfcf120df2df36258baad82c6619e to your computer and use it in GitHub Desktop.
useful git commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# show only file names | |
git diff --name-only SHA HEAD~1 > diff.txt | |
# delete old branches | |
git branch -a > branches.txt # dump all branches to file | |
&& sed -i '' 's/\/remote\/origin\///g' branches.txt # replace unneeded '/remote/origin/' prefix | |
&& nano branches.txt # manually delete branches that need to be keeped | |
&& cat branches.txt | xargs -I {} git push origin :{} # delete unneeded branches | |
# show added/deleted lines count | |
git log --author="Alwx" --pretty=tformat: --shortstat | cut -d' ' -f5,7 | awk '{for (i=1;i<=NF;i++) sum[i]+=$i;}; END{for (i in sum) print sum[i];}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment