Skip to contentSkip to conversation

Simple questions on GIT usage.

DISCUSSION Franck 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Franck

author
#0 lore raw

Hi,

I'd like to know how to delete an entire branch and all it's related objects. Is the following correct to accomplish that ?

        # rm -f .git/refs/heads/mybranch
        # git-prune

And a second question is: how to get the tree ID of the working repository ? I know it's very basic but I can't find out the answer in any documentations.

Thanks
--
Franck

#1 lore raw
Quoted 5 lines · Franck

Hi,

I'd like to know how to delete an entire branch and all it's related objects. Is the following correct to accomplish that ?

man git-branch

It will tell you about its -d and -D options.

Quoted 3 lines

And a second question is: how to get the tree ID of the working repository ?

I get a feeling there's a higher-level question behind this one, like "How can I get a diff between an updated (but not committed) index and the files in the working directory?"

When you have a problem it's usually better to just tell people what sort of end-result you're hoping to achieve and what steps you've taken to accomplish it so far. Asking for details about something that might be wrong thinking from the start won't help you but will still require much of our time to answer. I.e. nobody gains anything but the work still has to be done.

Incidentally, the answer to the quoted question above is (usually)
git diff-index -p HEAD

Otherwise;
man git (and look in the "IDENTIFIER TERMINOLOGY". I wish I had).

and

for i in /usr/bin/git-*tree*; do man ${i##*/}; done

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Andreas" == Andreas Ericsson <[email protected]> writes:

Andreas> man git-branch

Andreas> It will tell you about its -d and -D options.

It will? My manpage has no -d or -D option for git-branch.

And I've been looking for something like that too. If I want to abandon a what-if branch, how do I make sure that the branch and all objects are deleted?

Signature · 4 lines
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
#3 lore raw
Quoted 9 lines · Randal L. Schwartz
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Andreas" == Andreas Ericsson <[email protected]> writes:

Andreas> man git-branch

Andreas> It will tell you about its -d and -D options.

It will? My manpage has no -d or -D option for git-branch.

Ah. It's the help output that has them. I've submitted a patch to add them to the man-page though, so it should show up soonish.

Quoted 4 lines

And I've been looking for something like that too. If I want to abandon a what-if branch, how do I make sure that the branch and all objects are deleted?

git branch -D branchname
git prune

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
author
#4 lore raw
In reply to Franck

Andreas

Could you cc me when you're responding to my questions since I'm not subscribed to the GIT mailing list for now...thanks

git-branch -d option is not documented on online documentation at:
http://www.kernel.org/pub/software/scm/git/docs/
That's why I didn't find it by my self...

Regarding the second question, your feeling is wrong. What you described is well documented in the git tutorial. There's no "hidden" question behind the one I posted in my first email. So the question is
still: Is there a way to get information about the working repository ? For instance if I create a branch which is not based on the current HEAD position of master branch but instead is based on a previous poisition of master branch. Then later I want to know how I create this branch, how can I get this information ?

Thanks
--
Franck