GUIDE 10 / DEVELOPMENT
Git & collaboration
Track changes, inspect history, and synchronize working copies through GitLab.
In this guide
Commands use class paths and example filenames. Replace placeholders and inspect the target before making changes.
Review before committing
The working tree holds your files; the index stages the next commit. git diff shows unstaged changes. Untracked file contents do not appear in a normal git diff.
git status
git diff --stat
git diff
git diff --cachedA clean working tree means there are no pending local changes. It does not prove another computer has pushed its latest work.
Save a focused change
Stage named files, review the staged diff, commit, and push. A commit records a local snapshot; pushing sends commits to the remote.
git add scripts/shell/health-check.sh
git diff --cached
git commit -m "Add service and website health checks"
git pushKeep private keys, credentials, logs, and personal note databases out of Git. Add appropriate patterns to .gitignore before staging new files.
Inspect history and remotes
--oneline gives a compact commit list. --stat adds per-file change statistics; plain log also shows author, date, and message. Remote inspection explains where fetches and pushes go.
git log --oneline -3
git log --stat -1
git remote -v
git remote show origin
git pull --ff-onlyReview local changes before pulling. A repository copy and ~/scripts/shell are separate directories; pulling updates only the repository. Copy the intended scripts into your working location afterward.
Remove tracking deliberately
git rm removes a tracked file from the working tree and stages its deletion. --cached stages removal from tracking while leaving the local file in place.
git rm --cached notes-local.txt
git status
git ls-files --stage scripts/shell/health-check.shThe removal example changes the index; use it only for a file you intend to stop tracking. Add that path to .gitignore if appropriate. Git mode 100755 preserves the executable bit, not every Unix permission, owner, or ACL.