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

Re: Another use of "@"?

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 3, 2013, 06:39 UTC
Message-ID
<CAMP44s3pN22yfvs_PTzGFfp2cxm3gFMU0ofZ0bNBnzB_yfo+6Q@mail.gmail.com>
In-Reply-To
<CACsJy8AcWV8hmbhG27dw+GdnZf8NnQEctYmowqd3sSzOOHf+xg@mail.gmail.com>
On Thu, May 2, 2013 at 9:51 PM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 18 quoted lines
> Hi,
>
> My setup is a bit peculiar where I do git development on three
> different machines. Say I updated branch long-branch-name on machine
> A. Then I continue my work on machine B. I would want to hard reset
> that long-branch-name on machine B before resuming my work. What I
> usually do is
>
> git co long-branch-name
> git diff A/long-branch-name
> git reset --hard A/long-branch-name
>
> but typing long-branch-name (even with TAB completion) is not fun.
> Could I do this (or something similar) instead?
>
> git co long-branch-name
> git diff A/@
> git reset --hard A/@
Maybe this would make more sense:

%git co long-branch-name %git reset --keep A/long-branch-name

If you have changes but they don't conflict, they will be carried over, and it they do conflict, the reset won't continue. I think in most cases there will be no conflict, so the times you need to do 'git diff' will be rather small.

Yes, many times I would like an idiom that would just replace something with the current branch, like your A/@, but I don't know where the right place for that would be.

Also, I feel we are missing some kind of branch, like a remote-specific upstream, so instead of 'git reset A/foo' you would do 'git reset A@{u}'. By default the remote-specific upstream would be the same name of the branch, but it could be configured.

Moreover, we should probably have common aliases distributed (e.g. git co).
-- 
Felipe Contreras
Previous: Duy NguyenNext: Ramkumar Ramachandra
Message 9 of 11 in “Another use of "@"?”
  1. Duy NguyenMay 3, 2013
  2. Junio C HamanoMay 3, 2013
  3. Junio C HamanoMay 3, 2013
  4. Duy NguyenMay 3, 2013
  5. Thomas RastMay 3, 2013
  6. Matthieu MoyMay 3, 2013
  7. Duy NguyenMay 4, 2013
  8. Duy NguyenMay 4, 2013
  9. Felipe ContrerasMay 3, 2013
  10. Ramkumar RamachandraMay 4, 2013
  11. Matthieu MoyMay 4, 2013

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.