git/list[1] front-page[2] threads[3] people[4] search[5] about
 

specific push default

From
MDMichael Dressel <michaeltilodressel@t-online.de>
Date
Jan 27, 2008, 16:58 UTC
Message-ID
<alpine.DEB.1.00.0801271751490.3323@pollux.milkiway.cos>
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

Message 1 of 1 in “specific push default”
  1. Michael DresselJan 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.