DEV Community

Discussion on: What are your UNIX pipeline commands that saved you from lot of coding/time?

Collapse
 
erikdstock profile image
Erik

Some dumb and possibly dangerous variations I use:

# A blunt tool to fix changed ruby files before a commit
alias precommitfix="git status -s | awk '{print $2}' | grep .rb$ | xargs bundle exec rubocop -a"

# Delete merged remote branches (remove --dry-run after verifying)
git branch -r --merged | \
grep origin | \
grep -v '>' | \
grep -v master | \
xargs -L1 | \
awk '{sub(/origin\//,"");print}'| \
xargs git push origin --delete --dry-run