paulgsc / website

0 stars 1 forks source link

Nice To Know

Purpose

This document serves as a handy reference for various useful commands and techniques that can simplify and streamline your development workflow. Whether you're working with large repositories, managing branches, or tracking changes, these commands will help you navigate Git and other tools with ease.

Cloning a Git Repository with Sparse Checkout

Sparse checkout allows you to clone and work with only a subset of a repository, which is especially useful when dealing with large repositories.

  1. Clone the repository without checking out files:

    git clone --no-checkout --depth 1 https://github.com/username/repository.git
  2. Change into the repository directory:

    cd repository
  3. Initialize sparse checkout:

    git sparse-checkout init --cone
  4. Specify the directories and files you want:

    git sparse-checkout set path/to/dir1 path/to/dir2 path/to/file1
  5. Reapply sparse checkout settings:

    git sparse-checkout reapply
  6. Checkout the specified files and directories:

    git checkout

Additional Useful Commands

Checking the Status of Your Repository

Check the current status of your repository to see which files are staged, unstaged, or untracked:

git status

Stop all containers

docker stop $(sudo docker ps -aq)

Remove all Docker containers from your system.

# Regardless of their state (running, stopped, or exited).
docker rm $(sudo docker ps -aq)
# same for images
 docker rmi $(sudo docker images -q)

Remove All Stopped Containers

docker container prune -f

Remove All Unused Images

docker image prune -a -f

Removel all Unused Volumes

docker volume prune -f

Remove all Unused Networks

docker network prune -f