Skip to content

Teaching "git push" to map pushed refs

Junio C Hamano git 2 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 0 repliesNew
  2. v13 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3builtin/push.c: use strbuf instead of manual allocationbuiltin/push.c+14 -210 replies
2/3push: use remote.$name.push as a refmapDocumentation/git-push.txt builtin/push.c remote.c +2 more+96 -80 replies
3/3push: also use "upstream" mapping when pushing a single refbuiltin/push.c t/t5516-fetch-push.sh+41 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] Teaching "git push" to map pushed refs

The 'master' refspec in "git fetch origin master" used to mean "We grab their 'master' branch, but we do not store it in any of our remote-tracking branches." but in modern Git, the remote-tracking branch that would receive updates from 'master' with a corresponding "git fetch origin" (without any specific refs on the command line) is updated. Updating the same refs/remotes/origin/master with

git fetch origin
git fetch origin master

avoids surprises.

However, we did not have a similar refspec mapping on the push side. This three-patch series does just that. It would help triangular workflow by making these two:

	git checkout master && git push origin
	git push origin master

update the same ref at the 'origin'. It also would help those who need to emulate a fetch run on mothership from satellite with a push run on satellite into mothership (due to e.g. network connectivity issues).

The second round avoids instantiating the remote and the list of local heads until the very last minute when they are actually needed (the change is in the second patch).

Junio C Hamano (3):
builtin/push.c: use strbuf instead of manual allocation
push: use remote.$name.push as a refmap
push: also use "upstream" mapping when pushing a single ref

 Documentation/git-push.txt |  9 +++--
 builtin/push.c             | 84 ++++++++++++++++++++++++++++++++++------------
 remote.c                   |  8 ++---
 remote.h                   |  2 ++
 t/t5516-fetch-push.sh      | 75 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 150 insertions(+), 28 deletions(-)
Signature · 1 line
1.8.5.1-402-gdd8f092