develooper Front page | perl.perl5.porters | Postings from January 2009

Re: Minimal Perl git repostory

Thread Previous
From:
demerphq
Date:
January 7, 2009 12:31
Subject:
Re: Minimal Perl git repostory
Message ID:
9b18b3110901071231p16f980ceoc72637044c960679@mail.gmail.com
2009/1/7 Jerry D. Hedden <jdhedden@cpan.org>:
> On Wed, Jan 7, 2009 at 2:55 PM, demerphq <demerphq@gmail.com> wrote:
>> I still dont see why you do it like this. It seems a pity to not know
>> what branch the commit is on, for what seems to me to be no good
>> reason.
>
> I know about:   git checkout -b my-branch COMMIT_ID
> but this seems pointless as I don't see the need for creating
> a new branch.  I'm not going to be checking in any changes.

You know what "creating a new branch" means in this case?

Creating a file called .git/ref/heads/$name that contains 40 bytes of hex.

> How then do I set the branch according to the commit ID?
> For instance, commit ID  1f1f9ba37f5670f787f95ba511742e9cf4d9ca66
> is on the maint-5.10 branch.  How to I checkout that commit ID
> and set the branch to maint-5.10 (or origin/maint-5.10)?


Well assuming that you have already done:

git checkout -b maint-5.10 origin/maint-5.10

And that you do not do edits in your working directory and/or do not
care if changes get nuked you would do a recipe like this:

# optional setup, will nuke changes
git checkout maint-5.10
git reset --hard origin/blead
git fetch
git merge origin/blead

# and move the branch
git reset --hard COMMIT

and then after making the zip

git reset --hard origin/blead

This is a verbose  generic recipe, IOW, not all the steps are
absolutley necessary and or there may be configuration or  aliases to
make it shorter. However it should be safe in the sense that it should
work regardless of the state of the repo. Although it may nuke changes
you have made if you work on the named branches and not on topic
branches.

cheers,
Yves




-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About