The Git cheat sheet
Setup and connect Once
Windows: run everything in Git Bash, not PowerShell. No SSH on this network? Clone the https:// URL and paste a fine-grained Personal Access Token where it asks for a password.
Daily loop Every day
add puts items in the cart, commit checks out. Nothing is saved to history until you commit.
Start or join a repo Per project
Fork copies a repo to your GitHub account. Clone downloads it to your laptop. Fork once, clone as often as you like.
New repo on GitHub: + → New repository → name it → Public → leave Configuration untouched (README off, no .gitignore, no license) → Create. Anything switched on there is a commit your laptop lacks, and your first push is rejected.
Someone else's repo Every pull request
Squash if you are unsure which merge button to press: one pull request becomes one commit on main. GitLab calls the same thing a merge request.
Naming things Branches and commits
Imperative, lowercase after the colon, no full stop, first line under 72 characters. Match the repo: read git log --oneline and git branch -r before your first commit and use what they use. conventionalcommits.org
Branches and undo When needed
restore for files, reset for commits only you have, revert for commits others may have pulled. Never reset --hard on a shared branch.
The merge strategy Which button
Unsure? Squash. One pull request becomes one line in the log. Never rebase a branch others have pulled: it rewrites history they already hold. Use git revert there instead.
Merge conflicts When it breaks
Keep the text you want, delete the three marker lines. Often you keep both sides. Prevention: sync before you branch, and keep branches short.
Markdown README.md
A repo named exactly your-username makes its README your GitHub profile page.
Ship a site GitHub Pages
Settings → Pages → Deploy from a branch → main / root → Save. Live in about a minute at your-username.github.io/portfolio. Keep paths relative (href="style.css").
Keep going Resources
- Workshop repo
- github.com/Arlovzki/git-github-101
- Portfolio starter
- github.com/Arlovzki/portfolio-starter
- Practice
- learngitbranching.js.org
- When something goes wrong
- ohshitgit.com
- Read
- git-scm.com/book (Pro Git, free)
- Commit convention
- conventionalcommits.org
- Markdown
- markdownguide.org/cheat-sheet
- Profile README generator
- rahuldkjain.github.io/github-profile-readme-generator