Skip to content

Commit b31618b

Browse files
committed
Adding a project to repo using subtree
1 parent 061d6ba commit b31618b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
* [Retrieve the commit hash of the initial revision.](https://github.com/git-tips/tips#retrieve-the-commit-hash-of-the-initial-revision)
5858
* [Visualize the version tree.](https://github.com/git-tips/tips#visualize-the-version-tree)
5959
* [Deploying git tracked subfolder to gh-pages](https://github.com/git-tips/tips#deploying-git-tracked-subfolder-to-gh-pages)
60+
* [Adding a project to repo using subtree. Lets say we are adding in vendor directory](https://github.com/git-tips/tips#adding-a-project-to-repo-using-subtree-lets-say-we-are-adding-in-vendor-directory)
6061

6162
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
6263
<!-- @doxie.inject end toc -->
@@ -407,5 +408,10 @@ gitk --all
407408
git subtree push --prefix subfolder_name origin gh-pages
408409
```
409410

411+
## Adding a project to repo using subtree. Lets say we are adding in vendor directory
412+
```sh
413+
git subtree add --prefix=vendor/<project_name> --squash git@github.com:<username>/<project_name>.git master
414+
```
415+
410416
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
411417
<!-- @doxie.inject end -->

tips.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,9 @@
227227
"title": "Deploying git tracked subfolder to gh-pages",
228228
"tip": "git subtree push --prefix subfolder_name origin gh-pages",
229229
"alternatives": "git subtree push --prefix subfolder_name origin branch_name"
230+
},
231+
{
232+
"title": "Adding a project to repo using subtree. Lets say we are adding in vendor directory",
233+
"tip": "git subtree add --prefix=vendor/<project_name> --squash git@github.com:<username>/<project_name>.git master"
230234
}
231235
]

0 commit comments

Comments
 (0)