Friday, March 31, 2017

Tips: Some common Git commands

- git status

- Revert deleting a file
git reset HEAD <file>

- Checking out
git checkout <branch_or_tag>

- Check the difference between the origin and the remote:
git diff origin/Nightly

- git add
- git add .
- git push origin <branch>
- git commit -a -m "message"
- git checkout <branch>
- git log
- git checkout -- .
- git pull origin
- git cherry-pick <commit_id>
- git reset HEAD~
- git log -p filename

- Hard reset
git reset --hard origin/Nightly

- Clean the untracked files/directories
git clean -f -d

- git fetch --all
- git reset --hard origin/master

Tips: Few common Docker commands and tutorials

- Install docker compose

- List all running containers
docker ps

- List all the running and non-running containers
docker ps -a

- List all images in repository
docker images
docker images -a

- Display the logs
docker logs <container_name>

- Display the current running containers
docker ps -q

- Stop all the running containers
docker stop $(docker ps -q)

- Remove the container
docker rm

- Remove the image
docker rmi

- Can't remove container while it's running. You should stop and then remove

- Docker tutorials

- Starting docker compose
docker-compose up -d

- Stopping docker compose
docker-compose down

Tip: Configure using Meld Diff Viewer for git diff and git difftool

Run the below two commands for configuring Git to use Meld Diff Viewer on Ubuntu Linux:
git config --global diff.tool meld
git config --global difftool.prompt false