Append-only by default. Force-push only when you mean it.
Send commits and refs from your local repo to a remote. Append-only by default — the remote refuses non-fast-forward updates unless you force it.
Push asks the remote to update its refs to point at your commits, sending whatever objects the remote doesn't already have. The remote runs receive-pack to validate (hooks, ACLs, ref-update rules) and then writes refs.
git push [--all | --branches | --mirror | --tags] [--follow-tags] [--atomic]
[-n | --dry-run] [--receive-pack=<git-receive-pack>]
[--repo=<repository>] [-f | --force] [-d | --delete] [--prune]
[-v | --verbose] [-u | --set-upstream] [-o <string> | --push-option=<string>]
[--[no-]signed|--signed=(true|false|if-asked)]
[--force-with-lease[=<refname>[:<expect>]]] [--force-if-includes]
[--no-verify] [<repository> [<refspec>...]]| Flag | What it does |
|---|---|
-u, --set-upstream | Set upstream tracking on first push. |
--tags | Also push tags. |
--follow-tags | Push tags reachable from the pushed commits. |
--force, -f | ⚠️ Force-push. ⚠️ Overwrites the remote ref. Don't use on shared branches. |
--force-with-lease | Safer force-push: only if the remote tip is what you expect. |
--force-if-includes | Belt and suspenders for force-with-lease. |
-d, --delete <ref> | Delete a ref on the remote. |
--dry-run, -n | Show what would happen. |
$ git push -u origin feature/login$ git push --follow-tags$ git push --force-with-lease origin feature/login$ git push origin -d feature/old--force a shared branch. Always --force-with-lease if you must rewrite published history.push.default = current globally so a bare git push only pushes the current branch.--follow-tags with your release process so tags get to the remote without separate steps.push --force clobbers anyone else's commits made since the rewrite. --force-with-lease is the safer hammer.-u doesn't set up tracking, so future git pull may fail.Hit each option, then Check answers. Score is recorded; Next is always open.