From ee05f3f691f3422e02a8a10341f15a43464fdedd Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Sun, 3 May 2020 20:55:53 +0800 Subject: [PATCH] git-subtree: add page (#4012) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Zlatan Vasović Co-authored-by: Andrik Albuquerque Co-authored-by: Starbeamrainbowlabs --- pages/common/git-subtree.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pages/common/git-subtree.md diff --git a/pages/common/git-subtree.md b/pages/common/git-subtree.md new file mode 100644 index 0000000000..78ad587c25 --- /dev/null +++ b/pages/common/git-subtree.md @@ -0,0 +1,24 @@ +# git subtree + +> Tool to manage project dependencies as subprojects. +> More information: . + +- Add a git repository as a subtree: + +`git subtree add --prefix={{path/to/directory/}} --squash {{repository_url}} {{master}}` + +- Update subtree repository to its latest commit: + +`git subtree pull --prefix={{path/to/directory/}} {{repository_url}} {{master}}` + +- Merge a subtree repository into master: + +`git subtree merge --prefix={{path/to/directory/}} --squash {{repository_url}} {{master}}` + +- Push commits to a subtree repository: + +`git subtree push --prefix={{path/to/directory/}} {{repository_url}} {{master}}` + +- Extract a new project history from the history of a subtree: + +`git subtree split --prefix={{path/to/directory/}} {{repository_url}} -b {{branch_name}}`