home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] simple question about deleting a branch in git

  • Subject: Re: [OCLUG-Tech] simple question about deleting a branch in git
  • From: Richard Guy Briggs <rgb [ at ] tricolour [ dot ] ca>
  • Date: Mon, 21 Sep 2015 06:38:51 -0400
On 15/09/21, Robert P. J. Day wrote:
> 
>   perusing o'reilly's "version control with git (2nd ed)", doing more
> proofreading possibly in preparation for a 3rd edition, and ran across
> this passage about deleting branches i hadn't noticed before:
> 
> "Git won?t allow you to delete a branch that contains commits that are
> not also present on the current branch. That is, Git prevents you from
> accidentally removing development in commits that will be lost if the
> branch were to be deleted."
> 
>   hang on, that sounds contradictory. the first line claims that git
> won't allow you to delete a branch that contains commits not on the
> *current* branch, but the second line sounds more general in that git
> doesn't want you to delete a branch where you might lose work, but as
> long as the deleted branch commits are present on *some* branch (not
> necessarily the current one), you should be fine.
> 
>   can someone clarify this? is this as confusing as it seems to be to
> me?

My understanding is the -d option to delete a branch won't let you do so unless
it is in another branch (don't remember which branch), but -D will force that
delete regardless of the changes' existence in another branch.

> rday

	slainte mhath, RGB

--
Richard Guy Briggs               --  ~\    -- ~\             <hpv.tricolour.ca>
<www.TriColour.ca>                 --  \___   o \@      @        Ride yer bike!
Ottawa, ON, CANADA                  --  Lo_>__M__\\/\%__\\/\%
Vote! -- <greenparty.ca>_____GTVS6#790__(*)__(*)________(*)(*)_________________