Last active
March 29, 2016 11:58
-
-
Save artyom/d876e1c179627064e782 to your computer and use it in GitHub Desktop.
Manage dependencies with git subtrees
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -eu | |
| deps () { | |
| # format is "key path repo branch" | |
| cat <<-"EOF" | |
| dep1 libs/dep1 git@github.com:User/lib1.git master | |
| EOF | |
| } | |
| SEL=${1:-} | |
| BR=${2:-} | |
| deps | while read key path repo branch ; do | |
| test -n "$SEL" && test "$SEL" != "$key" && continue | |
| test -n "$BR" && branch=$BR | |
| git subtree pull --squash --prefix=$path $repo $branch | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It can be called in tree different ways:
(hard-coded in this script) to their latest versions or branch specified in
depsfunction;is short "name" of dependency hard-coded in this script) from its remote
branch hard-coded in
depsfunction;in previous case, and the second being specific branch name.