specific push default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

the model I  use git with has a central repository that is cloned by
developers and fetched and pushed into from developers. So the model is a
bit CVS like.

In order to have git fetch, when used without arguments (default behavior),
to fetch from all the branches in origin but to have git push, when used
without arguments (default behavior), to push only the current branch I
use a specific configuration.
For illustration I have created simple stupid example repositories attached
as zipped tar file to this e-mail. The example provides two sub directories.
The sub directory "cr" holds a bare git repository used to resemble a central
repository. The sub directory "dr" contains a git repository and a work tree
resembling a developers repository.

There are two branches: master and green. When git push (no arguments) is
invoked from one of the branches only the current branch gets pushed into
the central repository (cr). On the other hand if there where updates in the
central repository git fetch (no arguments) would fetch all branches.
Of course merging would only be done in the current branch.

This is probably a very specific way of using git. It took me a while to set
it up like that. Maybe that's just me. But maybe there is somebody else for
whom this e-mail could be of help.

Here is the .git/config of the "dr" directory:
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "rmt_master"]
        url = ../cr
        fetch = +refs/heads/*:refs/remotes/origin/*
        push = master
[remote "rmt_green"]
        url = ../cr
        fetch = +refs/heads/*:refs/remotes/origin/*
        push = green
[branch "master"]
        remote = rmt_master
        merge = refs/heads/master
[branch "green"]
        remote = rmt_green
        merge = refs/heads/green

Hint:
when e.g. "git remote add rmt_green ../cr" is used the remotes don't get
setup like that.A
"git config remote.rmt_green.fetch '+refs/heads/*:refs/remotes/origin/*'"
would be required in advance.


Cheers,
Michael

Attachment: pushex.tgz
Description: GNU Unix tar archive


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux