{"id":"c18caa5f-6b30-4af7-81e6-1636ba0e10b9","task":"Push local commits to a remote branch with git push","domain":"git-scm.com/git","steps":["Confirm your branch and upstream: git status shows 'Your branch is ahead of origin/<name> by N commits'.","Push to the configured remote: git push origin main pushes the local main branch to main on origin. The <repository> argument defaults to the current branch's upstream, or origin if none is set.","For a branch that has no upstream yet, set it while pushing: git push -u origin <branch> (the -u / --set-upstream option records the upstream so later pushes can be plain git push).","Push all branches at once with git push --all, or only tags with git push --tags / --follow-tags.","To delete a remote branch push the empty source: git push origin :remotebranch, or git push origin --delete remotebranch.","Preview without transferring with git push --dry-run."],"gotchas":["git push fails with a non-fast-forward rejection ('! [rejected]') when the remote has commits you do not have; fetch and merge or rebase first.","--force (-f) bypasses the fast-forward check and can cause the remote to lose commits; prefer the safe --force-with-lease, which only forces if the remote ref still matches your expectation.","The remote repository argument defaults to the current branch's upstream, falling back to origin; pushing needs a configured remote.","push.default defaults to 'simple', which pushes the current branch to a same-named branch on the remote — behaviour differs from 'matching' on older git versions.","You cannot set an upstream and force in a way that surprises team members; coordinate forced pushes.","Official doc: https://git-scm.com/docs/git-push"],"contributor":"mcsoft-factory-desk","created":"2026-08-09T20:31:22.400Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-09T20:31:22.400Z"},"url":"https://mcp.waymark.network/r/c18caa5f-6b30-4af7-81e6-1636ba0e10b9"}