git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Romain Vimont (®om)" <rom@rom1v.com>
Cc: <git@vger.kernel.org>
Subject: Re: [Not A BugReport] git tag -a / git show
Date: Fri, 24 Feb 2012 11:50:27 -0800	[thread overview]
Message-ID: <7vsji0yprw.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <b05f03b381140ca57a7d03a934f605bd@rom1v.com> ("Romain Vimont (®om)"'s message of "Fri, 24 Feb 2012 11:24:48 +0100")

"Romain Vimont (®om)" <rom@rom1v.com> writes:

> Now, I edit some files (for example in a config file
> "mock_data=true"), then I want to tag without commiting this change.

Tag applies to an existing commit [*1*].  Your change in the working tree
is purely ephemeral until it is committed.

In other words, you don't "tag without committing".

> $ git tag -a v0.1 -m 'My v0.1 with mock data'

By omitting the [<head>] part from your command line for a command whose
usage is:

  usage: git tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]

you asked <head> to default to HEAD, the most recent commit, so the tag
points at your 0ef41513d0b6 (This is the last commit).  The tag message
should say "My v0.1" without anything else.

And show naturally shows the patch to bring its parent to that tagged
commit.

If you wanted to keep your mainline pristine without mock data, and want
to have a playpen that uses mock data, a way to do so is to use a separate
branch, e.g.

        $ git checkout -b playpen

Now, you are on your 'playpen' branch that was forked from the tip of
whatever branch you were on, perhaps 'master'.  Then commit that state
with whatever change that is specific to the playpen you want to keep out
of the mainline:

	$ edit config.txt ;# set mock_data=true
        $ git commit -a -m 'With mock data'

You can optionally tag the resulting commit if you want to.  You are still
on the 'playpen' branch, so you probably would want to come back to the
previous branch after you are done.


[Footnote]

*1* technically, tag can apply to any type of object, but it is most
common to apply to a commit.

  parent reply	other threads:[~2012-02-24 19:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-24 10:24 [BugReport] git tag -a / git show Romain Vimont (®om)
2012-02-24 19:27 ` Zbigniew Jędrzejewski-Szmek
2012-02-24 19:55   ` Romain Vimont (®om)
2012-02-24 20:52     ` Jeff King
2012-02-24 21:42       ` Romain Vimont (®om)
2012-02-24 21:44         ` Jeff King
2012-02-24 19:50 ` Junio C Hamano [this message]
2012-02-24 19:58   ` [Not A BugReport] " Romain Vimont (®om)
2012-02-24 23:14     ` Andreas Schwab

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

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

  git send-email \
    --in-reply-to=7vsji0yprw.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rom@rom1v.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.
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 NNTP newsgroup(s).