Git tracks changes; GitHub hosts repositories and facilitates collaboration. This guide covers essential commands and a simple workflow to publish your site.
Common commands
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin [email protected]:you/repo.git
git push -u origin main
Branching and PRs
Create feature branches (git checkout -b feature/xyz), push them, and open a Pull Request on GitHub for reviews. Use descriptive commit messages and small commits.
Resolve conflicts
If you encounter merge conflicts, edit the conflicting files, test, then:
git add .
git commit -m "Resolve merge conflicts"
git push
Publish to GitHub Pages
Enable Pages in repo settings and choose branch and folder (root or docs). Add a CNAME for custom domains. GitHub Pages will publish your static site automatically.