Git 2.0 and push.default simple: Verify the branch before pushing
Revisit the 2014 Git 2.0 default with a two-branch example and use explicit targets and dry runs to catch incorrect CI branch configuration.
Archive retrospective · Topic year 2014
The default that changed in 2014
The Git project released version 2.0 on May 28, 2014. Its compatibility notes describe a change to push.default, the setting used when a push command leaves its refspec unspecified. The old matching default considered local branches with the same name on the destination. In a centralized workflow, the new simple default expects the current branch to track a branch of the same name at the same remote. The same git push invocation could therefore propose a different set of updates after an upgrade. A repository or user configuration may override the default.
A small example with two branches
Use a temporary central repository and a working copy with main and release branches. Start with both branches already present on the remote, then add an unpushed commit to release and another to main. Switch back to main and confirm that it tracks origin/main. Run the two commands below as dry runs. Matching should show pending updates for both branches, while simple should show an update for main. A local branch that has never been created on the remote is outside the matching set in this example. The dry runs leave the remote branch tips unchanged. Running these commands with Git 2.52.0 and explicit settings produced the two expected branch lists and left the remote refs unchanged.
git -c push.default=matching push --dry-run origin
git -c push.default=simple push --dry-run originDiagnose a differently named upstream
Suppose a local release-candidate branch tracks origin/release in the centralized setup. An implicit push in simple mode can stop because the names differ. Examine the current branch, the configured upstream and the actual push destination separately. The versioned Git 2.0 configuration manual specifies that simple behaves like current when you push to a different remote from the one you usually fetch from, so a push to a fork can behave differently from a push to the central repository. Checking these relationships helps distinguish a rejected branch selection from an authentication problem.
git branch -vv
git remote -v
git config --get push.defaultGive a CI push an explicit destination
If a release job is meant to send the local release branch to the remote branch of the same name, put that destination in the command. The dry run below makes both sides of the refspec visible. Review the proposed update against an allowlist before the write step is enabled. Then keep the write step bound to the permission granted for that remote and branch. Explicit targets make the same job easier to audit when a developer’s personal Git configuration differs from the configuration on the CI runner.
git push --dry-run origin refs/heads/release:refs/heads/releaseCheck three cases before changing the workflow
Record the Git versions and push.default values used by your team. In the disposable repository, verify three cases: a correctly tracked same-name branch, a differently named upstream and two branches that have both advanced. List the refs you expect before running each dry run, then compare the reported refs with that list. Stop the job if it proposes an unexpected destination and correct the refspec before retrying. Run separate checks for the shared repository and personal forks so that you can identify which workflows the historical change affects.
Sources, authors and verification
The primary source is the Git project’s Git 2.0 release notes on GitHub. The May 28, 2014 release records simple semantics as the new push.default behavior. The current git-push documentation still defines simple as pushing the current branch to a same-named remote branch and identifies it as the default since Git 2.0. The independent practitioner comparison is Lalit Sachdeva’s February 18, 2014 answer to Josh’s question on US-based Stack Overflow. That community answer is opinion and was not treated as the sole authority for command behavior. Sources: https://github.com/git/git/blob/master/Documentation/RelNotes/2.0.0.adoc ; https://git-scm.com/docs/git-push ; https://stackoverflow.com/questions/21839651/what-is-the-difference-between-push-default-matching-and-simple
Comments
No comments yet. Be the first to contribute.
Write a comment
Sample comments and editor reply
Discussion example — not real reader feedback. Names and conversations in this area are fictional. Likes and replies here are not saved and do not count as real engagement.
Example counters: 17,622 reads · 142 likes — not actual analytics
Reading “Git 2.0 and push.default simple: Verify the branch before pushing” raised this question for me: a small reproducible performance comparison would help.
Editor note: Results can vary by scale. Cost, latency and user experience should be compared together.
The learning curve and accessibility also matter for actual users.
A practical case study with load testing or a pilot would help establish the trade-offs.
Reading “Git 2.0 and push.default simple: Verify the branch before pushing” today, which limitations of that period still matter?
The topic year provides the historical context. Applying an archive finding today requires checking the source date and current conditions.
Which source would you recommend as a starting point for someone new to yazilim?
Which variables should stay fixed when comparing this result in another setting? A single measurement may not tell the whole story.
Could this link to another archive article on the same subject? Comparing the developments over time would be helpful.
The sources and archive links offer a starting point for further reading. Compare methods and scope as well as the headline claims.
Which questions remain open in “Git 2.0 and push.default simple: Verify the branch before pushing”? It would help to separate established findings from expectations.