Skip to content

Instantly share code, notes, and snippets.

@garborg
Created January 27, 2017 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garborg/1106bce3d639d93b862bba16771ad7db to your computer and use it in GitHub Desktop.
Save garborg/1106bce3d639d93b862bba16771ad7db to your computer and use it in GitHub Desktop.
Utility how-tos

clean up

Cleanup exited processes: docker rm $(docker ps -q -f status=exited) Cleanup dangling volumes: + docker volume rm $(docker volume ls -qf dangling=true) + or repeatedly: docker volume rm $(docker volume ls -qf dangling=true | head -3000) Cleanup dangling images: docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

Branches

Create and switch to branch: git checkout -b [mynewbranch]

List local branches: git branch -v

List all branches: git branch -av

Delete a branch: git branch -d [mybranch]

Delete an unmerged branch: git branch -D [mybranch]

Delete a remote branch: git branch -rd [myremote]/[mybranch]

Push to a new remote branch: git push -u [myremote] [mybranch]

Push to existing remote branch: git push [myremote] [mybranch]

Remotes

List remotes: get remote -v

Add a remote: git remote add [myremote] [url]

Black magic

Undoing git commit --amend and other spells

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment