Description
Sends the current branch to the remote, creating the branch there if it doesn't exist. There are no arguments and no upstream to set: the branch goes to origin, under the same name. To push a branch somewhere else, set branch.<name>.remote and branch.<name>.merge with grit config.
grit push never overwrites commits on the remote. If the remote branch has commits you don't have, the push is rejected and grit exits with an error; run grit pull and push again.
With --tags, pushes every local tag to origin instead of the current branch.
For GitHub over HTTPS, if a push fails because you aren't signed in, grit offers to run grit auth and then tries again.
Options
| Option | Description |
|---|---|
-t, --tags |
Push all tags instead of the current branch. |
JSON output
Pass --json for stable, scripting-friendly output:
| Field | Type | Meaning |
|---|---|---|
remote |
string | Remote that was pushed to. |
branch |
string | Branch that was pushed, or --tags. |
results |
array | Per-ref outcomes with ref and status (ok, up_to_date, or a rejection). |
rejected |
boolean | true if any ref was rejected (exit status is also 1). |