Everyday Work
The loop
flowchart LR
Edit[Edit files] --> Status[<code>oxy status</code>]
Status --> Diff[<code>oxy diff</code>]
Diff --> Commit[<code>oxy commit</code>]
Commit --> Push[<code>oxy push</code>]
Push --> Pull[<code>oxy pull</code>]
Pull --> Edit
Commit -. mistake? .-> Undo[<code>oxy undo</code>]
Undo -.-> Edit
| Task | Command |
|---|---|
| See what changed | oxy status, oxy diff |
| Record it | oxy commit -m "Message" |
| Record only some paths | oxy commit PATH.. -m "Message" |
| Pick hunks one by one | oxy commit -i -m "Message" |
| Look at history | oxy log, oxy log -v, oxy log -n 10 |
| Look at one change | oxy show 658990aa (a ChangeId prefix) or oxy show '#7469d16c' (a hash prefix) |
| Find who wrote a line | oxy blame src/parser.rs |
| Find what broke something | oxy bisect start, good, bad, run make test |
| Take back the last command | oxy undo |
Reading the log
oxy log draws history as a graph, newest first. Each change shows its ChangeId first, and its content hash after a #.
◉ 2f8518c0 Andy McCall just now
│ (working copy)
● 1b5888b1 Andy McCall 2 minutes ago main #cc23b999 ✔ signed
│ Edit b
│ ● d6f52eca Andy McCall 3 minutes ago main #ec6a7dc4 ✔ signed
├─╯ Edit a
○ c0593116 Andy McCall 5 minutes ago #eeac7940 ✔ signed
Both files
◉is the working copy and●is a head.- The two edits sit side by side because neither depends on the other. Both are heads of
main, which is normal in Oxygen: see Concepts.
Asking questions of history: revsets
-r takes a revset, a small query language over changes:
oxy log -r 'main.. & touches("src/**")' # changes not on main that touch src/
oxy log -r 'v0.3.1..main & author(me)' # my changes since a tag
oxy log -r 'delegated()' # changes an agent signed for me
The full language is in docs/revset_query_language.md.
Fixing up history
All of these are recorded in the operation log, so all can be undone.
oxy describe -m "Better message" # reword the change you are on
oxy amend # fold the working copy into it
oxy amend --into 658990aa # fold the working copy into an older change
oxy split 658990aa src/parser.rs # split a change by paths
oxy squash 658990aa --into 9df9ac29 # fold one change into another
oxy abandon 658990aa # drop a change
When you rewrite a change, the changes that depend on it are rewritten too and keep their ChangeIds.