The porcelain command chooses the remote and the refs, then may run a client hook.
git push reads the command line, remote.<name>.push, or push.default. It expands HEAD into a src:dst refspec and runs pre-push before send-pack talks to the network.
- Command
- git push
- 01argv
- 02remote
- 03src token
- 04handoff
git push CLI
Reading the animation: A command line becomes a remote name and a source token.
Parses the command and chooses remote plus what to send.
One command starts the specimen push
git push origin HEAD- Remote
- origin
- Src token
- HEAD
- push.default
- simple (unused here)
- Dry-run?
- no
git push is porcelain. With origin HEAD it uses the named remote and the current branch. Default push.default since Git 2.0 is simple: same-name current branch when you omit the ref.
In engineering terms: The git push CLI is that clerk. It has not opened the envelope or walked to the other building.
FOLLOW THIS EXAMPLE
- 01
Parse repository and ref arguments.
- 02
Resolve origin to its push URL.
- 03
Take HEAD as the source token.
- 04
Pass control to refspec expansion.
Picture handing a labeled envelope to a clerk: destination desk, which folder to file.
Where it stops matching: The clerk can still send the envelope to a desk you did not mean if HEAD is on an unexpected branch.Measurements, controls, and tradeoff
- Useful evidence
- Unexpected current branch, push.default surprises, and --dry-run still touching hooks.
- Controls
- push.default, remote.<name>.pushurl, and --dry-run.
- Tradeoff
- Omitting the ref is shorter and also depends on push.default, which has changed meaning across Git versions.
- Invocation
- origin HEAD
Definitions and sources
TERMS IN THIS VIEW
- Porcelain
- A user-facing Git command such as git push. It decides policy, then calls plumbing commands to move objects and refs.
- Remote
- A named repository URL, usually origin. pushurl can differ from the fetch URL.
- Refspec
- A src:dst pair that names which local ref to send and which remote ref to update. A leading + forces that one ref.
SOURCES + CONTINUE READING
Why it matters: If this layer picks the wrong dst, later layers will faithfully update the wrong remote branch.
Definitions for this layer
TERMS IN THIS VIEW
- Porcelain
- A user-facing Git command such as git push. It decides policy, then calls plumbing commands to move objects and refs.
- Refspec
- A src:dst pair that names which local ref to send and which remote ref to update. A leading + forces that one ref.
- pre-push
- A client hook that runs before anything is sent. Non-zero exit aborts the push.
- Remote
- A named repository URL, usually origin. pushurl can differ from the fetch URL.
