diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2019-03-29 10:39:16 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-02 04:57:00 (GMT) |
commit | 1806c29f2eb5f7e4b5952f4fcc75f2afe279f1a4 (patch) | |
tree | a3ae8668c6b94d37206498d73f6b95419f930fe5 /bundle.h | |
parent | c45f0f525de4701b8ff031d5c2c58c0fa819038e (diff) | |
download | git-1806c29f2eb5f7e4b5952f4fcc75f2afe279f1a4.zip git-1806c29f2eb5f7e4b5952f4fcc75f2afe279f1a4.tar.gz git-1806c29f2eb5f7e4b5952f4fcc75f2afe279f1a4.tar.bz2 |
switch: make --orphan switch to an empty tree
Switching and creating branches always involves knowing the
<start-point> to begin the new branch from. Sometimes, people want to
create a new branch that does not have any commits yet; --orphan is a
flag to allow that.
--orphan overrides the default of HEAD for <start-point> instead causing
us to start from an empty history with all tracked files removed from
the index and working tree. The use of --orphan is incompatible with
specifying a <start-point>.
A note on the implementation. An alternative is just create a dummy
commit in-core with empty tree and switch to it. But there's a chance
the commit's SHA-1 may end up somewhere permanent like reflog. It's best
to make sure "commit" pointer is NULL to avoid it.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bundle.h')
0 files changed, 0 insertions, 0 deletions