Re: Triangular workflow with Central repo
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 25, 2014, 17:32 UTC
- Message-ID
- <xmqqionoao9c.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CANR0-ag4ZKmHBNPxYkohBJEpXierFV+K3Ub4tH8YYD7FK73FdA@mail.gmail.com>
Mark Ferrell <major@homeonderanged.org> writes:
> push repository, but our use case relies on the pull branch being > different than the push branch. It would seem that git would need a > branch.<name>.push directive for this to work out.
I thought that you can tell recent versions of Git to pay attention to the remote.*.push patterns and use them as a refmap even when you are pushing a single branch?
Here is a demonstration:
$ (git init src && cd src && git commit --allow-empty -m foo)
$ git clone src dst
$ cd dst
$ edit .git/config ; cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ../src
fetch = +refs/heads/*:refs/remotes/origin/*
push = refs/heads/*:refs/heads/dev/me/*
# note that I edited out [branch "master"] section to show that
# you do not even need per-branch configuration.
$ git commit --allow-empty -m bar
$ git push
Counting objects: 1, done.
Writing objects: 100% (1/1), 184 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To ../src
* [new branch] master -> dev/me/masterFor simplicity I used two local repositories and used a random pattern "refs/heads/dev/me/*", trusting that the readers are capable of updating the example to use remote URLs and different hierarchies as needed.