npm install git-subtreeGit-subtree help you working with subtree commands.
Using a subtrees config file, you can clone a project and create all subtree remotes with one command. It also helps working with push/pull commands, adding prefix and branch from config.
``bash`
$ npm install -g git-subtree
The git-subtree configuration must be stored in subtrees.json file in the project root.
`json`
{
"mysubtree" : {
"localFolder": "subtrees/mysubtree",
"repository": "https://github.com/username/myrepo.git",
"branch": "master"
}
}
`bash`
$ gitsbt
`bash`
$ gitsbt init [username]
This command creates all remotes from subtrees config and if it's a new project, where subtrees folders are still not created, will fetch from subtree remote and add the subtree.
`bash`
$ gitsbt add
Adds git remote, fetch it and creates the local folder with subtree content.
`bash`
$ gitsbt pull
Pulls subtree changes from subtree remote.
`bash`
$ gitsbt push
Pushes subtree changes.
`bash``
$ gitsbt commit
Commits subtree pending changes.