hardrev

Use hr

Commits, branches, merges, clones, pull requests and releases.

If you know git, you mostly know hr. The big difference is the missing staging area. KiCad, your CAD program and your editor all change files behind hr's back, so hr commit takes the whole working tree, minus whatever .revignore excludes. Everything above Put a project on hardrev.dev works offline, with no account.

Start a project

cd ~/boards/psu-board
printf 'build/\n*.kicad_prl\nfp-info-cache\n' > .revignore
hr init
hr status
hr commit -m "First board"

.revignore follows gitignore syntax. The repository's own data sits in .rev/, and that folder never ends up in a commit. Until the first commit, hr status shows every file as "added".

Day to day

hr status                    # what changed since the last commit
hr diff                      # how it changed
hr commit -m "Move R1 away from the USB connector"
hr commit -m "Enclosure v2" cad/   # commit only what changed in cad/
hr log --oneline -n 10
hr show HEAD~1

When a KiCad, STEP or STL file changes, hr diff and hr show add a hardware: block after the usual diff. It lists components added, removed, changed or moved, the nets, and changes to the shape.

diff --rev a/board.kicad_pcb b/board.kicad_pcb
--- a/board.kicad_pcb
+++ b/board.kicad_pcb
@@ ... the changed lines ...
  hardware:
    PCB: components 1 → 2, nets 2 → 2
    + R2 1k (Resistor_SMD:R_0603_1608Metric)
    ~ R1 value 10k → 4.7k

To throw away your edits to one file, or pull an older version of a folder back out of history:

hr restore board.kicad_pcb
hr restore --source v1.0 cad/

Anywhere a command wants a revision, give it a branch, a tag, origin/main or a commit id. Four characters of an id are enough when they're unique. Add ~N to go back N commits, as in main~2.

Branches and merges

hr switch -c try-0402         # a new branch, and switch to it
# ... edit ...
hr commit -m "0402 passives"
hr switch main
hr merge try-0402
hr branch -d try-0402

If switching would overwrite work you haven't committed, hr switch refuses and leaves everything alone. Text files merge line by line. KiCad, CAD and other binary files never get merged as text, so when both branches changed one, your copy stays where it is and theirs is written next to it.

CONFLICT (binary): board.kicad_pcb — ours kept in board.kicad_pcb, theirs written to board.kicad_pcb.theirs
Merge stopped with 1 conflict. Resolve them, then run "hr merge --continue" (or "hr merge --abort" to undo the merge).

Open both in KiCad and save the one you want as board.kicad_pcb. Delete board.kicad_pcb.theirs and run hr merge --continue. Changed your mind? hr merge --abort puts the tree back exactly as it was.

Put a project on hardrev.dev

Sign in with hr login first (see Set up hr). Then create the repository on the Repositories page, with you or one of your organizations as the owner. New repositories stay private until you make them public. Connect your local project and push:

hr remote add origin https://api.hardrev.dev/<owner>/<repo>
hr push

hr push sends the current branch to origin, uploading only the objects the server doesn't have. To push another branch, name it with hr push origin <branch>, and add --tags to send tags too. Did someone else push in the meantime? Then the server turns yours down. Run hr pull and push again.

Clone and pull

Every repository page has a copy button with its clone command.

hr clone https://api.hardrev.dev/<owner>/<repo>
cd <repo>

Clones are shallow. You get the latest commit of each branch while the older history stays on the server, which keeps a project full of large board and CAD files quick to clone. For more history:

hr clone https://api.hardrev.dev/<owner>/<repo> --depth 10   # the latest 10 commits per branch
hr clone https://api.hardrev.dev/<owner>/<repo> --full       # everything
hr fetch --deepen 10                                          # in a clone: 10 more
hr fetch --full                                               # in a clone: the rest

hr pull fetches and then merges, handling conflicts the way hr merge does. hr fetch downloads and stops.

Pull requests

Push a branch, then open a pull request from the terminal or from the repository's page.

hr switch -c r1-pullup
# ... edit, commit ...
hr push origin r1-pullup
hr pr create --title "R1 to 4.7k" --body "The pull-up was too strong."
hr pr list
hr pr view 1                  # commits, files with their hardware summaries, comments
hr pr comment 1 -m "Looks good"
hr pr merge 1
hr pr close 3                 # close without merging

When both sides touched the same KiCad file, the server won't merge the pull request, and it lists the files in conflict. Do the merge on the pull request's branch, push that, and merge again:

hr switch r1-pullup
hr pull origin main           # writes board.kicad_pcb.theirs
# resolve in KiCad, delete the .theirs file
hr merge --continue
hr push origin r1-pullup

Tags and releases

Tag whatever you send to the fab, and attach the exact files that went with it.

hr tag -a v1 -m "First boards ordered"
hr push --tags
hr release create v1 --title "Rev A" --notes "Sent to the fab." --attach out/gerbers.zip
hr release list

3D previews

Push a SolidCraft design (.sc) and hr converts it to a 3D model with the SolidCraft installed on your machine, then uploads the model so the repository page can show it. No SolidCraft? You get one line saying so, and the push goes through anyway. hr push --no-previews turns previews off.

Claude Code and other MCP clients

hr mcp runs an MCP server for one repository. Its tools are status, commit, log, diff, branch, switch, tag, push, pull, pr_create and pr_list. hardware-studio wires it up for you. To add it to Claude Code by hand:

claude mcp add hardrev -- hr mcp --repo /path/to/board

Help

hr --help
hr <command> --help

The exit code is 0 for success, 1 when the operation failed (one line on stderr says why) and 2 for a usage error. For scripts, status, log, show, diff, branch, tag, push, pull, pr and release all take --json.

Next: Set up hardware-studio