docs: add simple 'add' case to clarify setup.
This patch adds a simple use case for adding a library to an existing repository. Signed-off-by: Dan Sabath <dsabath@whitepages.com>
Dan Sabath committed
Feb 8, 2010 at 20:31 UTC
c6ca48d4dc5b93a7576d2afa66b057f8c8a20718
1 file changed
+26
-2
git-subtree.txt
+26
-2
@@ -225,7 +225,31 @@ OPTIONS FOR split
225
226
EXAMPLE 1
227
---------
228
-Let's use the repository for the git source code as an example.
228
+Let's assume that you have a local repository that you would like
229
+to add an external vendor library to. In this case we will add the
230
+git-subtree repository as a subdirectory of your already existing
231
+git-extensions repository in ~/git-extensions/.
232
+
233
+First we need to fetch the remote objects
234
+ $ cd ~/git-extensions
235
+ $ git fetch git://github.com/apenwarr/git-subtree.git master
236
+
237
+'master' needs to be a valid remote ref and can be a different branch
238
+name
239
+
240
+Now we add the vendor library with
241
+ $ git subtree add --prefix=git-subtree --squash FETCH_HEAD
242
+
243
+You can omit the --squash flag, but doing so will increase the number
244
+of commits that are incldued in your local repository.
245
+
246
+We now have ~/git-extensions/git-subtree directory with the git-subtree
247
+subdirectory containing code from the master branch of
248
+git://github.com/apenwarr/git-subtree.git
249
+
250
+EXAMPLE 2
251
+---------
252
+Let's use the repository for the git source code as an example.
253
First, get your own copy of the git.git repository:
254
255
$ git clone git://git.kernel.org/pub/scm/git/git.git test-git
@@ -284,7 +308,7 @@ the standard gitweb:
308
309
git log gitweb-latest..$(git subtree split --prefix=gitweb)
310
287
-EXAMPLE 2
311
+EXAMPLE 3
312
---------
313
Suppose you have a source directory with many files and
314
subdirectories, and you want to extract the lib directory to its own