git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Magnus Bäck" <magnus.back@sonyericsson.com>
Cc: Abscissa <bus_nabble_git@semitwist.com>, git@vger.kernel.org
Subject: Re: Checkout tag?
Date: Sun, 22 Jan 2012 03:30:34 -0800 (PST)	[thread overview]
Message-ID: <m3ipk4dlfy.fsf@localhost.localdomain> (raw)
In-Reply-To: <20120122101116.GA31022@jpl.local>

Magnus Bäck <magnus.back@sonyericsson.com> writes:
> On Sunday, January 22, 2012 at 11:05 CET,
>      Abscissa <bus_nabble_git@semitwist.com> wrote:
> 
> > I've managed to figure out you switch branches with the checkout
> > command, like this:
> > 
> >   $ git checkout branch_name
> > 
> > Does that work for tags as well? The docs don't seem clear on that.
> > If not, how do you get the working copy to be a specific tag?
> 
> Yes, "git checkout" works for branches, tags, commit SHA-1s, and
> anything else that can be resolved to a SHA-1 identifying what to
> check out. [...]

Note however that because you can generate new commits only on top of
local branches (refs/heads/*), if you check out something other than
local branch, e.g.:

  $ git checkout v1.7.8
  $ git checkout origin/next
  $ git checkout HEAD^

you would be after such checkout in unnamed anonymous branch which
contents corresponds to what you checked out.  This state is called
'detached HEAD', and shows e.g. in "git branch output as

  $ git branch
  * (no branch)
  master
  ...

On the other hand if you don't want to checkout tag to explore it, but
set contents of working area to the state it was in given tag, you can
use

  $ git checkout v1.7.8 -- .

HTH


P.S. Instead of Nabble you can use GMane interface, or just use email
(you don't have ot be subscribed to git@vger.kernel.org to post, and
it is custom here to send replies also to author(s)).

-- 
Jakub Narebski

  parent reply	other threads:[~2012-01-22 11:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-22 10:05 Checkout tag? Abscissa
2012-01-22 10:11 ` Magnus Bäck
2012-01-22 10:25   ` Abscissa
2012-01-22 11:31     ` Magnus Bäck
2012-01-22 17:08       ` Jonathan Nieder
2012-01-22 17:33         ` Magnus Bäck
2012-01-22 10:26   ` Abscissa
2012-01-22 10:26   ` Abscissa
2012-01-22 10:27   ` Abscissa
2012-01-22 10:27   ` Abscissa
2012-01-22 10:28   ` Abscissa
2012-01-22 10:28   ` Abscissa
2012-01-22 10:29   ` Abscissa
2012-01-22 11:30   ` Jakub Narebski [this message]
2012-01-22 10:18 ` Nguyen Thai Ngoc Duy
2012-01-22 10:29   ` Abscissa
2012-01-22 10:34     ` Abscissa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3ipk4dlfy.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=bus_nabble_git@semitwist.com \
    --cc=git@vger.kernel.org \
    --cc=magnus.back@sonyericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).