Everything you need to start using Git and GitHub
git --version
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git init
git clone https://github.com/user/repo.git
git status
git add .
git add filename.txt
git commit -m "Initial commit"
git log
git log --oneline
git branch feature
git checkout feature
git switch feature
git checkout -b feature
git switch -c feature
git branch -d feature
git merge feature
git remote add origin https://github.com/user/repo.git
git remote -v
git push -u origin main
git push
git pull
git fetch
git restore file.txt
git restore --staged file.txt
git reset HEAD~1
git stash
git stash list
git stash pop
git tag v1.0
git push origin v1.0
| Task | Command |
|---|---|
| Status | git status |
| Add Files | git add . |
| Commit | git commit -m "message" |
| Push | git push |
| Pull | git pull |
| New Branch | git checkout -b branch |
| Merge | git merge branch |