From: Junio C Hamano <gitster@pobox.com>
To: Konstantin Hollerith <khollerith@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Why does 'git branch -d' act differntly after clone?
Date: Thu, 20 Aug 2015 08:49:24 -0700 [thread overview]
Message-ID: <xmqqa8tm7yez.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CALwJaCzYgDKdcT7H7=5x0fnNRv4MsrtjJoHJcB9rJyh3dU--xQ@mail.gmail.com> (Konstantin Hollerith's message of "Thu, 20 Aug 2015 14:10:37 +0200")
Konstantin Hollerith <khollerith@gmail.com> writes:
> Why does git branch -d acts differently after a clone?
In the former case, that branch is the only thing that knows about
the commits near the tip of it. Immediately after you clone that
repository, you have a copy of that branch as a remote-tracking
branch for origin/neuerTestBranch. You didn't say how you got a
local copy of it in there, but I'd imagine that in the clone you did
something like:
$ git checkout neuerTestBranch
which is a short-hand for
$ git checkout -b neuerTestBranch origin/neuerTestBranch
and then went back to a branch other than that branch when you asked
the branch to be removed, e.g.
$ git checkout master
$ git branch -d neuerTestBranch
without building any further history on neuerTestBranch.
Now, your local neuerTestBranch is a mere unmodified copy of the
remote-tracking branch origin/neuerTestBranch; the commits on the
former will not become unreachable if you remove neuerTestBranch,
because they are all reachable via origin/neuerTestBranch. And that
is why the deletion of it has less severe potential of information
lossage, compared to the original case where you attempt to remove
the only copy.
prev parent reply other threads:[~2015-08-20 15:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-20 12:10 Why does 'git branch -d' act differntly after clone? Konstantin Hollerith
2015-08-20 15:49 ` Junio C Hamano [this message]
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=xmqqa8tm7yez.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=khollerith@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.