Monday, September 26, 2016

Mercurial Hg - frequently used commands

hg clone
copy a locally non-existent repository from remote repository
hg pull --rebase
pull changes from remote to local, rebase local commits on new head
hg pull -u
pull changes from remote to local, update working dir to new head
hg update [optionally: where]
updates working dir to head or specified revision
hg st
hg status
list status of the working directory
hg commit
commit changes
hg commit --amend
amend last commit
hg push
push to remote repository
hg rebase -s [what] -d [where]
rebase one commit and its children to another commit -- commits specified by [commit number]
hg strip --keep [what and its children]
remove a commit and its children, and keep the changes in the working directory
hg strip [what and its children]
delete a commit and its children (will not keep changes!)
hg purge
cleans the working directory
hg shelve
hg unshelve
shelve or unshelve changes in the working directory

Tuesday, September 20, 2016

Docker: frequently used commands

list all images:
docker images
list all containers:
docker ps -a
stop all running containers:
docker stop $(docker ps -a -q)
remove all containers:
docker rm $(docker ps -a -q)
force (-f) remove all running or non-running containers:
docker rm -f $(docker ps -a -q)
remove all images:
docker rmi $(docker images -q)
build docker image with the tag tutorial/webapp:latest from the path .:
docker build -t tutorial/webapp:latest .
download a docker image from the docker hub:
docker pull tutorial/webapp:latest
run the image tutorial/webapp with the specified --name, in the background (-d), exposing inner port 8080 on 80 (-p) and setting an environmental variable (-e):
docker run --name tutorial -d -p 80:8080 -e "ENV_VAR=env-var" tutorial/webapp
run bash console inside the container:
docker exec -it nameofthecontainer /bin/bash
build a docker image from a Dockerfile in the current directory:
docker build --tag my_image .