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

problem when pulling a specific branch from origin

From
IKIvan Kanis <expire-by-2011-02-06@kanis.fr>
Date
Feb 1, 2011, 17:25 UTC
Message-ID
<877hdjy8d8.fsf@kanis.fr>
Hello,

When I pull a specific branch from a repository I get in a state where git thinks I am ahead of the branch by one commit. The use case is a programmer that doesn't want to pull all the branches of the server.

I have made a small script to reproduce the problem:

---- #!/bin/sh

rm -rf foo bar git --version mkdir foo cd foo git init echo foo > foo.txt git add foo.txt git commit -am"foo" git checkout -b branch cd .. git clone foo bar cd foo echo bar > foo.txt git commit -am"bar" cd .. cd bar git pull origin branch git status git branch -rv ----

I get the following output:
----
git version 1.7.3.5
Initialized empty Git repository in /home/ivan/tmp/foo/.git/
[master (root-commit) eefa065] foo
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo.txt
Switched to a new branch 'branch'
Cloning into bar...
done.
[branch 7ecd065] bar
 1 files changed, 1 insertions(+), 1 deletions(-)
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /home/ivan/tmp/foo
 * branch            branch     -> FETCH_HEAD
Updating eefa065..7ecd065
Fast-forward
 foo.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
  origin/HEAD   -> origin/master
  origin/branch eefa065 foo
  origin/master eefa065 foo
----

I expected to not be ahead of origin/master and that origin/branch points to 7ecd065. Is this a bug?

Take care,
-- 
Ivan Kanis

Sure, ninety percent of science fiction is crud. That's because ninety
percent of everything is crud.
    -- Theodore Sturgeon 
Next: Konstantin Khomoutov
Message 1 of 3 in “problem when pulling a specific branch from origin”
  1. Ivan KanisFeb 1, 2011
  2. Konstantin KhomoutovFeb 2, 2011
  3. Ivan KanisFeb 2, 2011

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.