Skip to content

svuillaume/docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

docker build -t samv-docker .

version 2 - update

🧠 Git Cheat Sheet

Welcome to your ultimate Git command reference! Below you'll find the most essential commands, categorized for easy navigation.


πŸ› οΈ Setup & Config

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --list
Configure your identity for Git commits.

πŸ“ Initialize & Clone
git init                      # Create a new Git repo
git clone <url>              # Clone a repo
git clone git@github.com:me/repo.git  # Clone via SSH

πŸ”„ Working with Changes
git status                   # See current changes
git add <file>               # Stage file(s)
git add .                    # Stage all changes
git commit -m "message"      # Commit with a message
git commit -am "msg"         # Add + commit tracked files
βœ… Tip: git commit -am skips git add for already tracked files.

πŸ“œ Branching
git branch                   # List branches
git branch <name>           # Create new branch
git checkout <name>         # Switch branch
git checkout -b <name>      # Create and switch
git merge <name>            # Merge branch into current
git branch -d <name>        # Delete branch

🌍 Remotes
git remote -v                            # Show remotes
git remote add origin <url>             # Add remote
git remote set-url origin <new-url>     # Change remote URL

πŸ“€ Push & Pull
git push origin <branch>     # Push branch
git pull origin <branch>     # Pull latest changes
git fetch                    # Download commits without merge
πŸ” Use SSH to avoid entering credentials every push.

🧭 Stashing
git stash              # Save changes for later
git stash list         # List stashed items
git stash apply        # Reapply last stash
git stash pop          # Apply + remove stash

πŸ•°οΈ Logs & History
git log                     # Show commit log
git log --oneline --graph   # Compact view
git show <commit>           # Show specific commit

❌ Undo & Reset
git restore <file>          # Undo changes to file
git reset <file>            # Unstage file
git reset --hard            # Discard all changes
git revert <commit>         # Revert a commit
πŸ” Useful Tips
🏷️ Use .gitignore to exclude files.

πŸ”€ Use git rebase to clean history.

πŸ› Use git bisect to find bugs.

πŸš€ Advanced
git cherry-pick <commit>     # Apply a commit from another branch
git rebase -i HEAD~3         # Interactive rebase (edit history)
git tag <name>               # Create a tag
git diff                     # Show unstaged changes

πŸ§ͺ Example Workflow
# Start a new project
git init
git add .
git commit -m "Initial commit"
git remote add origin git@github.com:me/project.git
git push -u origin main

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published