Zeeshan Kanuga’s Post

🚀 Most Useful Git Commands Every DevOps Engineer Should Know Whether you’re starting your Git journey or brushing up for professional work, mastering these commands will boost your productivity and confidence. 1️⃣ Repository Management git init → Initialize a new repository git clone <repo> → Clone an existing repository git remote -v → View remote repository details git remote add origin <url> → Link local repo to remote 2️⃣ Staging & Committing git add <file> → Stage specific changes git add . → Stage all changes git commit -m "message" → Commit changes with a message git commit --amend → Edit the last commit 3️⃣ Branching & Merging git branch → List all branches git branch <branch> → Create a new branch git checkout -b <branch> → Create & switch to a branch git merge <branch> → Merge a branch into current branch git branch -d <branch> → Delete a branch git checkout <branch> → Switch to a branch 4️⃣ Viewing History & Changes git log → View commit history git log --oneline → View commit history in one line git diff → View unstaged changes 5️⃣ Undoing Changes git reset <file> → Unstage a file (changes remain) git restore <file> → Restore a file to last committed state git reset --hard <commit> → Reset branch to a commit, discarding local changes git revert <commit> → Create a new commit that undoes a previous commit 6️⃣ Remote Collaboration git push origin <branch> → Push changes to remote git pull origin <branch> → Pull changes from remote 7️⃣ Status Check git status → Shows current working directory and staging area status 💡 Pro Tip: Practice these commands daily. The more you use them, the more fluent you become in Git. These commands are the foundation for efficient version control in real-world DevOps workflows. Follow my #GitRevision journey for step-by-step Git tips, commands, and strategies! #Git #DevOps #VersionControl #GitCommands #CloudComputing #LearningGit #100DaysOfDevOps

To view or add a comment, sign in

Explore content categories