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

pushing changes to a remote branch

From
MKmartin f krafft <madduck@madduck.net>
Date
Jul 10, 2007, 14:36 UTC
Message-ID
<20070710143614.GA29681@piper.oerlikon.madduck.net>
Hi list,

I am using git-remote to clone a remote repository and track only a select number of branches:

  git remote add -f -t vim -t ssh origin git://git.server.org/path/to/repo.git
  git branch -r
    origin/ssh
    origin/vim
  git merge ...

I now merge these into the local repo and decide that I need to make a change to origin/vim. So I figure that it's probably easiest if I just checkout the remote branch, make the change, commit it, push it, return to the master branch, git-remote update and merge, but:

  git checkout origin/vim
    Note: moving to "origin/vim" which isn't a local branch
  echo change > newfile; git add newfile
  git commit -m'make change'
    Created commit 64b8b2e: make change
     1 files changed, 1 insertions(+), 0 deletions(-)
      create mode 100644 newfile
  
If I now checkout master and then return to origin/vim, the commit
is gone.

If I repeat all this and, instead of returning to master, I push the commit to origin, git suggests success (the push looks normal). However, I then cannot find the commit anymore. It's not available locally, nor in origin/vim, nor in the local master branch or in origin/master.

This is curious and I'd love to find out what's going on.

Much more, however, I am interested how I am supposed to push commits back to select remote branches.

Using
  git push git://git.server.org/path/to/repo.git \
    7fbb0655:refs/heads/vim

does push commit 7fbb0655 to the vim branch in the remote repository, but I should be able to do this using origin/vim, no? How?

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: madduck.bogus@madduck.net
 
"the worst part of being old is remembering when you was young."
                                -- alvin straight (the straight story)
Next: Jeff King
Message 1 of 10 in “pushing changes to a remote branch”
  1. martin f krafftJul 10, 2007
  2. Jeff KingJul 10, 2007
  3. Brian GernhardtJul 10, 2007
  4. Jeff KingJul 10, 2007
  5. Sean KelleyJul 11, 2007
  6. Jan HudecJul 11, 2007
  7. Jan HudecJul 11, 2007
  8. Junio C HamanoJul 11, 2007
  9. Jan HudecJul 14, 2007
  10. Jan HudecJul 11, 2007

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.