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

Re: [PATCH] git-checkout --push/--pop

From
David Kågedal <davidk@lysator.liu.se>
Date
Dec 5, 2007, 17:44 UTC
Message-ID
<877ijt2g0q.fsf@lysator.liu.se>
In-Reply-To
<vpqir3de8t6.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 11 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Matthieu, is this something that forgetful people would find useful?
>
> Not sure. That's obviously an interesting feature, but adding two more
> options to checkout (which is already a huge swiss-army knife) might
> not be worth the trouble.
>
> And the issue with push/pop approaches is that I usually notice I have
> to use pop after not having used push (i.e. I use "cd -" all the time,
> but rarely "pushd"/"popd").

It is probably more common that you want to be able to switch back to the previous branch, than that you actually need a full stack.

So a "git checkout --previous" could be enough.  Or a set of aliases
[alias]
	co = !"git symbolic-ref HEAD | sed -ne 's!refs/heads/!!p' > .git/LAST ; git checkout"
        pop = !"git co $(cat .git/LAST)"
-- 
David Kågedal
Previous: Matthieu MoyNext: Robin Rosenberg
Message 10 of 14 in “[RFC] Introduce .git/BRANCH to point to the current branch”
  1. Salikh ZakirovDec 4, 2007
  2. Matthieu MoyDec 4, 2007
  3. Jakub NarebskiDec 4, 2007
  4. Junio C HamanoDec 4, 2007
  5. Matthieu MoyDec 4, 2007
  6. Junio C HamanoDec 4, 2007
  7. git-checkout --push/--popNanako Shiraishi, Dec 4, 2007
  8. Junio C HamanoDec 5, 2007
  9. Matthieu MoyDec 5, 2007
  10. David KågedalDec 5, 2007
  11. Robin RosenbergDec 6, 2007
  12. Salikh ZakirovDec 4, 2007
  13. Junio C HamanoDec 4, 2007
  14. Jakub NarebskiDec 4, 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.