๐Ÿง  Git Cheat Sheet --- Essential Commands

โš™๏ธ Initial Configuration

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --list

๐Ÿ“‚ Create or Clone a Repository

git init
git clone https://github.com/user/project.git

๐Ÿ”„ Track Changes

git status
git add file.txt
git add .
git diff

๐Ÿ’พ Save Changes (Commits)

git commit -m "Clear commit message"
git commit -am "Message"

๐Ÿงฉ History and Tracking

git log
git log --oneline --graph --decorate
git show <hash>

๐ŸŒฟ Branches

git branch
git branch new-branch
git checkout new-branch
git switch -c new-branch
git merge other-branch
git branch -d branch

โ˜๏ธ Working with a Remote Repository

git remote -v
git remote add origin https://github.com/user/project.git
git push -u origin main
git pull
git fetch

โ™ป๏ธ Undo / Fix Changes

git restore file.txt
git restore --staged file.txt
git reset --hard HEAD
git revert <hash>

๐Ÿงผ Clean Up

git clean -fd

๐Ÿ“ฆ Useful Commands

git stash
git stash pop
git tag v1.0