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

Re: git fetch vs push, git am questions

From
KKKonstantin Khomoutov <flatworm@users.sourceforge.net>
Date
Dec 9, 2010, 13:57 UTC
Message-ID
<20101209165711.9cca1f28.kostix@domain007.com>
In-Reply-To
<60371291725083@web106.yandex.ru>

On Tue, 07 Dec 2010 15:31:23 +0300 Konstantin Kivi <kkivi@yandex.ru> wrote:

>>  `git pull` does exactly that: fetch + merge (which should result in
>>  fast-forward in your case).
> pull does not work on bare repos.

Then the only way to update any branch after fetching I can think of is using `git update-ref` and the information from FETCH_HEAD.

Show 9 quoted lines
>>> I also found that there is a notions of current branch in bare
>>> repository
>>>  How can I change current branch in bare repositry?
> I think I will understand things better if I get what is 'current
> branch' for bare repository and how to change it
>>  By re-writing the HEAD ref (this behaviour is documented in the
>> man page of the `git clone` command, see the "--branch" option for
>> instance).
> The repository already exists, so git-clone  will not help

I did not propose to use git-clone, I just stated which section of which manual page hints at what is considered to be the current branch in a bare repository when Git clones it.

>>  You can use the `git symbolic-ref` to update the HEAD ref.
> Do you mean something like 
> git symbolic-ref  master origin/master ?

Something like git symbolic-ref HEAD refs/heads/master

P.S. I also wonder how did you manage to get origin/master in a bare repository. When I `git clone --bare` an existing Git repository, I get one branch named "master" (or whatever branch was current in the source repository), and in the `git clone` manual page we see:

 --bare
   Make a bare GIT repository. That is, instead of creating
 <directory> and placing the administrative files in <directory>/.git,
 make the <directory> itself the $GIT_DIR. This obviously implies the -n
 because there is nowhere to check out the working tree. Also the branch
 heads at the remote are copied directly to corresponding local branch
 heads, without mapping them to refs/remotes/origin/. When this option
 is used, neither remote-tracking branches nor the related configuration
 variables are created.

Which describes the behaviour I see. So it seems you have somehow botched setup. Like you took a non-bare repository and just copied its ".git" subdirectory somewhere pretending it's now a bare repo.

Previous: Konstantin KiviNext: Neal Kreitzinger
Message 4 of 5 in “git fetch vs push, git am questions”
  1. Konstantin KiviDec 6, 2010
  2. Konstantin KhomoutovDec 7, 2010
  3. Konstantin KiviDec 7, 2010
  4. Konstantin KhomoutovDec 9, 2010
  5. Neal KreitzingerDec 7, 2010

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.