Setup & GitHub Minimal Daily Checklist for Working with Repos

Sort:
Avatar of AlAlper
1) One-time setupInstall & configure Git# Global identity (use anything; it stays local)git config --global user.name "Your Name"git config --global user.email "you@example.local"# Sensible defaultsgit config --global init.defaultBranch main git config --global pull.ff only git config --global fetch.prune truegit config --global rerere.enabled true # auto-resolve repeated mergesgit config --global core.autocrlf true # Windows; use 'input' on macOS/Linux# macOS/Linux: git config --global core.autocrlf inputVS Code essentials
  • Extensions: GitLens, Git Graph, Prettier (or Black/ruff for Python), EditorConfig, language linters.

  • Settings (File → Preferences → Settings → search the keys below):

    • git.enableSmartCommit: true

    • git.confirmSync: false

    • files.trimTrailingWhitespace: true

    • editor.formatOnSave: true

    • diffEditor.ignoreTrimWhitespace: true

  • Workspace .vscode/settings.json (checked into the repo) for formatter/linter choices.

Project skeleton (top level).vscode/ .gitignore.gitattributesREADME.mdCHANGELOG.mddocs/ scripts/ src/ tests/

.gitignore (good cross-platform base)

# OS.DS_Store Thumbs.db# Editors.vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/extensions.json# Dependencies / buildsnode_modules/ dist/ build/ *.log

.gitattributes (line endings consistent)

* text=autoOptional: local “remote” for extra safety

Create a bare repo on the same machine or another drive and push to it like a remote:

# Create a bare backup repomkdir -p D:/git-backups/myproject.git # or /mnt/data/git-backups on Linuxcd D:/git-backups && git init --bare myproject.git# In your working repo:git remote add backup D:/git-backups/myproject.git

You now have origin (optional) and backup (a path remote). You can also point backup to a USB drive or a network share.


2) Daily working loop (VS Code + Git)A. Start of daygit status git fetch --all # if you use a local bare remote shared by other machines/usersgit switch -c feat/short-description # or 'git switch main' if continuingB. While coding
  • Keep changes small and focused.

  • Run tests/linters locally (add VS Code Tasks to automate).

  • Commit early, commit often with clear messages (Conventional Commits optional):

    feat(parser): add FEN validationfix(ui): correct dark theme contrastchore: update dependencies
git add -p # stage hunks interactivelygit commit -m "feat(parser): add FEN validation"

If you need to pause:

git stash push -u -m "WIP board animations"# ...switch to another task...git stash pop C. Midday or after each task
  • Rebase your feature branch on main to keep history clean:

    git switch feat/board-anim git fetch --all git rebase main
  • Push to your local backup:

    git push backup HEAD
D. End of day “check-in”
  1. Make sure working tree is clean.

git add -A git commit -m "chore: EOD checkpoint" || echo "Nothing to commit"
  1. Tag an EOD snapshot (optional but great for rollback):

git tag -f eod-$(date +%Y-%m-%d) git push backup --tags git push backup --all
  1. Create a portable bundle archive (air-gap-safe backup):

git bundle create ../myproject-$(date +%Y%m%d).bundle --all

Copy the bundle to another drive/cloud. You can restore with
git clone myproject-20250817.bundle myproject.


3) Branching & history
  • main: always green (tests pass).

  • feat/ branches for features; fix/ for bugfixes; chore/ for maintenance.

  • Use rebase (not merge) to keep linear history:

    git rebase -i main
  • Squash tiny fixups before integrating:

    git commit --fixup <SHA> git rebase -i --autosquash main

4) Quality gates (local only)
  • Pre-commit hooks (no server needed):

    • Option A: lightweight manual hooks in .git/hooks/ (not versioned by default).

    • Option B (recommended): pre-commit framework (versioned config).

      pip install pre-commit # or use pipx/uv/condapre-commit sample-config > .pre-commit-config.yaml pre-commit install

      Add linters/formatters; they’ll run before each commit.

  • VS Code Tasks to standardize:
    .vscode/tasks.json

    {"version": "2.0.0","tasks": [{ "label": "test", "type": "shell", "command": "pytest -q" },{ "label": "lint", "type": "shell", "command": "ruff check ." },{ "label": "format", "type": "shell", "command": "ruff format ." }]}

5) Weekly maintenance (5–10 min)# Update tools/deps, run full test suitegit switch main git pull --rebase --all # from local remotes if usedgit gc --prune=now --aggressive # tidy up repogit tag -a v0.1.0 -m "Alpha snapshot" # if you hit a milestonegit push backup --tags --all
6) Collaboration without GitHub (optional)
  • Local file remote on a shared drive: others add backup as their origin.

  • Ad-hoc patch exchange:

    git format-patch -1 <SHA> # creates .patch filesgit am < 0001-some-change.patch
  • Self-hosted options (later): Gitea, GitLab CE, or git daemon over LAN.


7) Recovery quick recipes
  • Undo last commit (keep changes staged):

    git reset --soft HEAD~1
  • Discard local changes to a file:

    git checkout -- path/to/file
  • Restore from bundle:

    git clone /path/to/myproject-20250817.bundle myproject

8) Minimal daily checklist (copy/paste)
  • git status (clean?)

  • Pull/rebase from main (if using a shared local remote)

  • Work on feat/<topic>; commit small, clear messages

  • Run tests/linters before commit

  • git push backup HEAD after each logical chunk

  • End-of-day tag + bundle backup