Git Cheat Sheet: Common Commands and Workflow

Still confused between git add, git commit, and git push? Here’s a beginner-friendly cheat sheet of the most commonly used Git commands 👇 🔹 git init Initialize a new Git repository. 🔹 git clone <repo-url> Copy an existing repository to your local machine. 🔹 git status Check which files are changed, staged, or not tracked. 🔹 git add <file> Add a file to the staging area. Use git add . to add all changed files. 🔹 git commit -m "message" Save your changes with a meaningful message. 🔹 git push Upload your local commits to the remote repository. 🔹 git pull Fetch the latest changes from the remote repository. 🔹 git branch View all branches. 🔹 git checkout <branch-name> Switch to another branch. 🔹 git checkout -b <branch-name> Create and switch to a new branch. 🔹 git merge <branch-name> Merge another branch into your current branch. 🔹 git log View commit history. 🔹 git diff See the difference between your current code and previous version. 🔹 git rm <file> Delete a file from the repository. 🔹 git reset --hard Undo all local changes (use carefully ⚠️) 💡 Most common Git workflow: git status git add . git commit -m "your message" git push Mastering Git is one of the most important skills for every developer, tester, and automation engineer. Which Git command do you use the most? 👇 #Git #GitHub #Programming #Developer #SoftwareTesting #AutomationTesting #Python #Java #Coding #Tech #SoftwareEngineer #LearnToCode

  • graphical user interface, text, application, chat or text message

Spot on! 🎯 Prati T. For those of us in Automation, mastering git branch and git checkout -b is essential. Keeping your "work-in-progress" scripts on a separate branch ensures the main CI/CD pipeline stays green. Which command do I use most? Definitely git status—I probably check it every 5 minutes! 😂

To view or add a comment, sign in

Explore content categories