My console cheat-sheet

Photo by David Travis on Unsplash

There are some things that can be useful to me, but I totally keep forgetting the syntax. Well, not any longer!




# display branching tree
git log --graph --full-history --all --pretty=format:"%h%x09%d%x20%s";
git log --graph --decorate --oneline;
# display history of commits for a specific branch
git log --walk-reflogs master;

Work with tags

# get all remote tags
git fetch --all --tags;
# kill remote tag
git push --delete origin v1.2.0;
# kill local tag
git tag -d v1.2.0;


# parametrized alias
alias dssh='function __sampleAlias(){ docker exec -it $1 /bin/bash; };__sampleAlias';
# launch chrome from the command line in Mac
alias chrome="/Applications/Google\\ \\\\ \\Chrome";
# get console command by its PID
ps -p [PID] -o args;


# make a total package upgrade
yarn upgrade <package-name> --major
# find out why the package was installed
yarn why <package-name>
# get version of an installed package
yarn info <package-name> | grep version:


# remove all exited containers
docker rm $(docker ps -a -f status=exited -q)
# remove all working containers
docker rm $(docker ps -a -q)
# remove all images
docker rmi $(docker images -a -q)
# remove volumes, networks
docker system prune

To be continued...