Clean up git repos

git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'

https://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit

Free disk space

sudo apt clean
docker image prune
docker system prune --all

clean up pip cache

error checking context: no permission to read from
find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf

git

1. Revert from commit-hash1 to commit-hash2

git revert --no-edit <commit-hash1>...<commit-hash2>

2. Copy all commit messages

3. Merge all revert CLs into one

git reset --soft hash1

4. Rebase with strategy

git pull origin HEAD:refs/for/master --rebase -X theirs

parse git log

gitlogparser -dir ./
cat logdata_new.json | jq '.[:30]' | jq '.[] | .message'

bash

awk '{sum += $1} END {print sum}' file.txt
# merge two files into one, seperated by ,
pr -s, -tm file1 file2