Git Commands 🛠 git init – Initialize a new Git repository 📥 git… — Web Development Project — TG.ME

Git Commands

🛠 git init – Initialize a new Git repository
📥 git clone <repo> – Clone a repository
📊 git status – Check the status of your repository
git add <file> – Add a file to the staging area
📝 git commit -m "message" – Commit changes with a message
🚀 git push – Push changes to a remote repository
⬇️ git pull – Fetch and merge changes from a remote repository


Branching



📌 git branch – List all branches
🌱 git branch <name> – Create a new branch
🔄 git checkout <branch> – Switch to a branch
🔗 git merge <branch> – Merge a branch into the current branch
⚡️ git rebase <branch> – Apply commits on top of another branch


Undo & Fix Mistakes



git reset --soft HEAD~1 – Undo the last commit but keep changes
git reset --hard HEAD~1 – Undo the last commit and discard changes
🔄 git revert <commit> – Create a new commit that undoes a specific commit


Logs & History


📖 git log – Show commit history
🌐 git log --oneline --graph --all – View commit history in a simple graph


Stashing



📥 git stash – Save changes without committing
🎭 git stash pop – Apply stashed changes and remove them from stash


Remote & Collaboration



🌍 git remote -v – View remote repositories
📡 git fetch – Fetch changes without merging
🕵️ git diff – Compare changes


Don’t forget to react ❤️ if you’d like to see more content like this!
❤25🔥2👍1💘1
September 18, 2025 9.8K 4 58