--- 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 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> | Reapply commits on top of another base branch
--- Undo & Fix Mistakes ---
๐ git reset --soft HEAD~1 | Undo last commit but keep changes
๐ซ git reset --hard HEAD-1 | Undo last commit and discard changes
โช git revert <commit> | Create a new commit that undoes changes from a specific commit
--- Logs & History ---
๐ git log | Show commit history
๐ git log --oneline --graph --all | Pretty graph of commit history
--- 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
Post #2479
2.14K
- โค 3
- ๐ 2