🔹 Initialize & First Push (Local → GitHub)
git init
git branch -M main
git remote add origin https://github.com/<username>/<repo-name>.git
git add .
git commit -m "Initial commit"
git push -u origin maingit add <file-name>
git add <file1> <file2>
git add .
git add -Agit commit -m "message"
git commit -am "message"git push
git push origin maingit pull
git pull origin maingit fetch origin
git merge origin/maingit clone https://github.com/<username>/<repo-name>.gitgit status
git log
git log --oneline
git branchgit branch <branch-name>
git checkout <branch-name>
git checkout -b <branch-name>
git merge <branch-name>
git branch -d <branch-name>git remote -v
git remote remove origin
git remote set-url origin <new-url>git restore <file>
git reset <file>
git reset --soft HEAD~1
git reset --hard HEAD~1git stash
git stash pop
git stash listgit tag v1.0.0
git push origin v1.0.0git push --force
git pull --rebasegit clean -fdgit config --global user.name "Your Name"
git config --global user.email "your@email.com"If you want:
- Cheat-sheet image
- Beginner-safe subset
- Professional Git workflow (PR-based)
say the word.