author | Junio C Hamano <gitster@pobox.com> | |
Mon, 12 Jul 2010 06:47:29 +0000 (23:47 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 12 Jul 2010 06:47:29 +0000 (23:47 -0700) |
* maint:
Documentation: Spelling fix in protocol-capabilities.txt
checkout: accord documentation to what git does
t0005: work around strange $? in ksh when program terminated by a signal
Documentation: Spelling fix in protocol-capabilities.txt
checkout: accord documentation to what git does
t0005: work around strange $? in ksh when program terminated by a signal
1 | 2 | |||
---|---|---|---|---|
Documentation/git-checkout.txt | patch | | diff1 | | diff2 | | blob | history |
diff --combined Documentation/git-checkout.txt
index 261dd90c381eccbd87d73325478e1d5abcf05e15,7b831622239872b1567eada42fa03331a6b3494f..1bacd2e1044f5b3b7d5a60e1687387cc277fc52a
--------
[verse]
'git checkout' [-q] [-f] [-m] [<branch>]
-'git checkout' [-q] [-f] [-m] [-b <new_branch>] [<start_point>]
+'git checkout' [-q] [-f] [-m] [[-b|--orphan] <new_branch>] [<start_point>]
'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
'git checkout' --patch [<tree-ish>] [--] [<paths>...]
Create the new branch's reflog; see linkgit:git-branch[1] for
details.
+--orphan::
+ Create a new 'orphan' branch, named <new_branch>, started from
+ <start_point> and switch to it. The first commit made on this
+ new branch will have no parents and it will be the root of a new
+ history totally disconnected from all the other branches and
+ commits.
++
+The index and the working tree are adjusted as if you had previously run
+"git checkout <start_point>". This allows you to start a new history
+that records a set of paths similar to <start_point> by easily running
+"git commit -a" to make the root commit.
++
+This can be useful when you want to publish the tree from a commit
+without exposing its full history. You might want to do this to publish
+an open source branch of a project whose current tree is "clean", but
+whose full history contains proprietary or otherwise encumbered bits of
+code.
++
+If you want to start a disconnected history that records a set of paths
+that is totally different from the one of <start_point>, then you should
+clear the index and the working tree right after creating the orphan
+branch by running "git rm -rf ." from the top level of the working tree.
+Afterwards you will be ready to prepare your new files, repopulating the
+working tree, by copying them from elsewhere, extracting a tarball, etc.
+
-m::
--merge::
When switching branches,
+
------------
$ git checkout mytopic
- fatal: Entry 'frotz' not uptodate. Cannot merge.
+ error: You have local changes to 'frotz'; not switching branches.
------------
+
You can give the `-m` flag to the command, which would try a