Explorar o código

fetch the remote before the first edit of a session

The local checkout was behind at the moment of the push three times now,
and the last one was rejected as non-fast-forward: four commits of someone
else's work, touching AGENTS.md and README.md, which is where a stale
copy of this file is written. Reading a remote in the middle of a rebase
is how a session ends up reconstructing work it already had.

The fetch belongs before the first edit, because a working tree that has
already been edited turns a rebase into a conflict resolution. Rebase,
never force-push: the commits behind are other work, and this branch is
not the only writer.
Paul-Dieter Klumpp hai 1 semana
pai
achega
88d0cde7be
Modificáronse 1 ficheiros con 28 adicións e 0 borrados
  1. 28 0
      AGENTS.md

+ 28 - 0
AGENTS.md

@@ -23,6 +23,34 @@ For the effect catalog specifically, read it from no document at all. Run
 effects than Backlight, and only the tool knows what the current firmware
 supports.
 
+## Fetch the Remote Before the First Edit
+
+`origin/main` moves while you work, and this repository is worked on from more
+than one machine. Check it before the first edit of a session, not before the
+push: a working tree that starts a rebase half-finished has already lost work.
+
+```sh
+git fetch origin && git log --oneline HEAD..origin/main && git diff --stat HEAD...origin/main
+```
+
+Read what the incoming commits touch, and rebase onto them before editing:
+
+```sh
+git rebase origin/main
+```
+
+`git status -sb` reporting `ahead N, behind M` means both are true, and `M > 0`
+is the one that ends in a rejected push. A `non-fast-forward` rejection is that
+same finding one step too late — rebase, never force-push, because the commits
+behind are other people's work and this branch is not the only writer.
+
+Three times now the local checkout has been behind at the moment of the push,
+and once the incoming commits touched `AGENTS.md` and `README.md` as well, which
+is where a stale copy of this file is written. A commit built against a tree that
+no longer exists is not wrong, it is orphaned, and the checks that would have
+caught it — `go test ./...` and the doc tests in `cmd/qmk-rgb-tool` — run against
+whatever is on disk, not against `origin/main`.
+
 ## Objective
 Cross-platform Go CLI library for programmatic/agent-friendly control of QMK keyboard RGB lighting.