Skip to content

Instantly share code, notes, and snippets.

View dgreda's full-sized avatar

Damian Gręda dgreda

View GitHub Profile
# run Rubocop only on modified Ruby files which haven’t been committed to git
alias rubogit='git ls-files -m | grep '\.rb$' | xargs bundle exec rubocop'
@dgreda
dgreda / BashFunctions.md
Last active March 14, 2018 11:04
Useful Bash Functions that you can add to your profile

Generating Release Notes as JIRA Links

function git-jira-links() {
  git log $1 | grep -Eo '([A-Z]{2,}-)([0-9]+)' | sort -u | awk '{ print "https://your.jira.domain/browse/"$1; }'
}

Usage example:

git-jira-links master..develop

@dgreda
dgreda / Terminal.md
Created December 20, 2016 22:41
Mac Tips & Tricks

Create ISO file

hdiutil makehybrid -iso -joliet -o Image.iso /input_path

@dgreda
dgreda / Docker.md
Last active May 12, 2017 06:49
Docker Helpers

Remove all exited containers

sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm

or

docker rm $(docker ps -q -f status=exited)

Remove all untagged images

docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")

Clean up Docker.qcow2

WARNING: it deletes all stopped containers, all volumes not used by at least one container and all images without at least one referring container.

@dgreda
dgreda / Git.md
Last active May 31, 2020 15:21
Git Tips & Tricks

Delete branches already merged to master

git branch --merged master | grep -v "master" | xargs -n 1 git branch -d

Reduce git repository size

git gc --aggressive --prune=now