git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* (no subject)
@ 2020-01-03 12:40 François WAUQUIER
  2020-01-04  0:48 ` git checkout - Jonathan Nieder
  0 siblings, 1 reply; 3+ messages in thread
From: François WAUQUIER @ 2020-01-03 12:40 UTC (permalink / raw)
  To: git

Hi

$ git checkout -

I often use this command to go back to previous branch from my history.
It is quite natural as it uses the same syntax as “cd -“

But i found out it is not documented in
https://git-scm.com/docs/git-checkout/2.24.0
I report this to help others to discover this time saving command.

Thanks for the great work with git
Happy new year

-- 
François Wauquier

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git checkout -
  2020-01-03 12:40 François WAUQUIER
@ 2020-01-04  0:48 ` Jonathan Nieder
  2020-01-04  5:17   ` Todd Zullinger
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2020-01-04  0:48 UTC (permalink / raw)
  To: François WAUQUIER; +Cc: git

Hi,

François WAUQUIER wrote:

> $ git checkout -
>
> I often use this command to go back to previous branch from my history.
> It is quite natural as it uses the same syntax as “cd -“
>
> But i found out it is not documented in
> https://git-scm.com/docs/git-checkout/2.24.0
> I report this to help others to discover this time saving command.

Thanks for reporting!

Ideas for what the documentation should say about it?  (Bonus points
if it comes in the form of a patch against Documentation/git-checkout.txt.
;-)  See [1] for more about how that works.)

Sincerely,
Jonathan

[1] https://www.kernel.org/pub/software/scm/git/docs/SubmittingPatches.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git checkout -
  2020-01-04  0:48 ` git checkout - Jonathan Nieder
@ 2020-01-04  5:17   ` Todd Zullinger
  0 siblings, 0 replies; 3+ messages in thread
From: Todd Zullinger @ 2020-01-04  5:17 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: François WAUQUIER, Nguyễn Thái Ngọc Duy,
	git

Hi,

Jonathan Nieder wrote:
> Hi,
> 
> François WAUQUIER wrote:
> 
>> $ git checkout -
>>
>> I often use this command to go back to previous branch from my history.
>> It is quite natural as it uses the same syntax as “cd -“
>>
>> But i found out it is not documented in
>> https://git-scm.com/docs/git-checkout/2.24.0
>> I report this to help others to discover this time saving command.
> 
> Thanks for reporting!
> 
> Ideas for what the documentation should say about it?  (Bonus points
> if it comes in the form of a patch against Documentation/git-checkout.txt.
> ;-)  See [1] for more about how that works.)

Not to say that it can't possibly be improved, but it is
mentioned in the git-checkout docs here[1].  The second
paragraph in that section says:

    You can use the @{-N} syntax to refer to the N-th last
    branch/commit checked out using "git checkout"
    operation. You may also specify - which is synonymous to
    @{-1}.

This is also in the git-switch documentation, where it might
be easier to find, as it's very close to the beginning of
git-switch's man page, in the "<start-point>" entry of the
OPTIONS section[2].

Being easy to miss in the git-checkout documentation might
make Duy smile; it shows the benefit of splitting some of
the many features of 'checkout' to the 'switch' command. :)

[1] https://git-scm.com/docs/git-checkout#Documentation/git-checkout.txt-ltbranchgt
[2] https://git-scm.com/docs/git-switch#Documentation/git-switch.txt-ltstart-pointgt

-- 
Todd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-04  5:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03 12:40 François WAUQUIER
2020-01-04  0:48 ` git checkout - Jonathan Nieder
2020-01-04  5:17   ` Todd Zullinger

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).