Re: [Not A BugReport] git tag -a / git show
Thank you for the details.
> *1* technically, tag can apply to any type of object, but it is most
common to apply to a commit.
To what other type of object can you apply a tag ?
Good evening.
Le vendredi 24 février 2012 à 11:50 -0800, Junio C Hamano a écrit :
Show 48 quoted lines
> "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.
>