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

Re: [RFC] rebase: use @{upstream} if no upstream specified

From
Jeff King <peff@peff.net>
Date
Nov 19, 2010, 21:15 UTC
Message-ID
<20101119211533.GA18942@sigill.intra.peff.net>
In-Reply-To
<AANLkTin+3FuuX_pavZQMrbi4qxjTRvM7nHk1PXcFbeiZ@mail.gmail.com>
On Tue, Nov 16, 2010 at 09:29:46PM -0500, Martin von Zweigbergk wrote:
Show 15 quoted lines
> > What about simply checking if "rev-parse @{u}" succeeds, in which case
> > we can use upstream_name=@{u} ?  If it fails, then we can do the work
> > of finding where the config flaw is (and delegate this to a func).
> > That would help keep the nominal code path short.
> 
> Will make sure to find out the error only when needed as you suggest.
> 
> I thought I would need the ref name to be able to walk the reflog if my
> other propasal would be accepted (see
> http://thread.gmane.org/gmane.comp.version-control.git/161381), but it
> seems to work with @{u} as well. I just adapted the call from 'git pull'
> (git-parse-remote.sh), but I guess I could use 'git rev-parse @{upstream}'
> instead. It does seem more natural to me.
> 
> Maybe one of the guys on the CC list can advise?

I'm not quite sure I understand the question, coming into the middle of the conversation. If you want to know "can I traverse the reflog of the upstream with @{u}", the answer is yes. We dereference the ref first (similarly, foo@{u}@{3.days.ago} looks at the upstream branch's reflog). If you want the refname, you can also use "git rev-parse --symbolic-full-name @{u}".

Does that help?
-Peff
Previous: Martin von ZweigbergkNext: Martin von Zweigbergk
Message 4 of 11 in “[RFC] rebase: use @{upstream} if no upstream specified”
  1. Martin von ZweigbergkNov 12, 2010
  2. Yann DirsonNov 13, 2010
  3. Martin von ZweigbergkNov 17, 2010
  4. Jeff KingNov 19, 2010
  5. Martin von ZweigbergkNov 20, 2010
  6. Jeff KingNov 20, 2010
  7. Martin von ZweigbergkNov 20, 2010
  8. Kevin BallardNov 15, 2010
  9. Martin von ZweigbergkNov 15, 2010
  10. Jay SoffianNov 15, 2010
  11. Kevin BallardNov 15, 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.