Git Cheat Sheet
Setup
Set your name to be used as the commit author
git config --global user.name "Name Surname"
Set your email to be used as the commit author
git config --global user.email "[email protected]"
Creating Repositories
Initialize a new Git repository
git init
Clone an existing repository
git clone <repository>
Making Changes
Check the status of your repository
git status
Add a file to the staging area
git add <file>
Add all modified and new files to the staging area
git add .
Commit changes with a message
git commit -m "message"
Remove a file from the staging area
git reset HEAD <file>
Viewing History
View the commit history
git log
View changes that have not been staged
git diff
View changes that have been staged
git diff --staged
Working with Remotes
Add a remote repository
git remote add <name> <url>
Push changes to a remote repository
git push <name> <branch>
Pull changes from a remote repository
git pull <name> <branch>
Branching
List all branches
git branch
Create a new branch
git branch <name>
Delete a branch
git branch -d <name>
Switch to a branch
git checkout <name>
Merging
Merge a branch into the current branch
git merge <branch>
Stashing Changes
Stash changes
git stash
View a list of stashes
git stash list
Apply the latest stash
git stash apply
Discard the latest stash
git stash drop
Tagging
Create a new tag
git tag <tagname>
Create a new tag with a message
git tag -a <tagname> -m "message"
Delete a tag
git tag -d <tagname>
Push tags to the remote repository
git push --tags
Reverting Changes
Revert the last commit
git revert HEAD
Revert a specific commit
git revert <commit>
Resetting
Reset the staging area to the last commit
git reset HEAD
Reset the staging area and working directory to the last commit
git reset --hard HEAD
Reset the staging area and working directory to a specific commit
git reset --hard <commit>
Aliases
Create aliases for commonly used commands
git config --global alias.<alias_name> <git_command>
Patreon Exclusives
Join my Patreon and dive deep into the world of Docker and DevOps with exclusive content tailored for IT enthusiasts and professionals. As your experienced guide, I offer a range of membership tiers designed to suit everyone from newbies to IT experts so you will get
What You’ll Get
🏆 Patron-Only Posts: Gain access to in-depth posts that provide a closer look at Docker and DevOps techniques, including step-by-step guides, advanced tips, and detailed analysis not available to the general public.
🏆 Early Access: Be the first to view new content and tutorials, giving you a head start on the latest technologies and methods in the IT world.
🏆 Priority Support: Have your specific questions and challenges addressed with priority, ensuring you get the most tailored and direct support possible.
🏆 Influence Future Content: Your suggestions and feedback directly influence the topics and tutorials I create, making sure the content is highly relevant and useful to your needs.
🏆 Recognition and Interaction: Active participants and supporters receive shout-outs in videos and public streams, acknowledging your important role in our community.
🏆 Special Discounts: Enjoy discounts on courses and future events, exclusively available to Patreon members.
🏆 Networking Opportunities: Connect with other IT professionals and enthusiasts in a supportive and engaging environment, expanding your network and learning collaboratively.
🏆 Heartfelt Gratitude and Updates: My personal thanks for your support, which fuels the creation of more content and allows continuous improvement and expansion.
Join me now and start your journey to mastering Docker and DevOps with exclusive insights and a supportive community!
My Courses
🎓 Dive into my comprehensive IT courses designed for enthusiasts and professionals alike. Whether you’re looking to master Docker, conquer Kubernetes, or advance your DevOps skills, my courses provide a structured pathway to enhancing your technical prowess.
My Services
💼 Take a look at my service catalog and find out how we can make your technological life better. Whether it’s increasing the efficiency of your IT infrastructure, advancing your career, or expanding your technological horizons — I’m here to help you achieve your goals. From DevOps transformations to building gaming computers — let’s make your technology unparalleled!
Refill My Coffee Supplies
💖 PayPal
🏆 Patreon
💎 GitHub
🥤 BuyMeaCoffee
🍪 Ko-fi
Follow Me
🎬 YouTube
🐦 Twitter
🎨 Instagram
🐘 Mastodon
🧵 Threads
🎸 Facebook
🧊 Bluesky
🎥 TikTok
💻 LinkedIn
📣 daily.dev Squad
🧩 LeetCode
🐈 GitHub
Is this content AI-generated?
Nope! Each article is crafted by me, fueled by a deep passion for Docker and decades of IT expertise. While I employ AI to refine the grammar—ensuring the technical details are conveyed clearly—the insights, strategies, and guidance are purely my own. This approach may occasionally activate AI detectors, but you can be certain that the underlying knowledge and experiences are authentically mine.