git-multirepo 1.0.0.beta42 → 1.0.0.beta43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +2 -2
- data/.gitbugtraq +3 -3
- data/.gitignore +38 -38
- data/.multirepo.meta +2 -2
- data/.rspec +2 -2
- data/Gemfile +4 -4
- data/Gemfile.lock +42 -42
- data/LICENSE +22 -22
- data/README.md +143 -143
- data/Rakefile +2 -2
- data/bin/multi +10 -10
- data/docs/bug-repros/91565510-repro.sh +20 -20
- data/git-multirepo.gemspec +31 -31
- data/lib/commands.rb +13 -13
- data/lib/git-multirepo.rb +2 -2
- data/lib/info.rb +4 -4
- data/lib/multirepo/commands/add-command.rb +50 -50
- data/lib/multirepo/commands/branch-command.rb +81 -81
- data/lib/multirepo/commands/checkout-command.rb +119 -119
- data/lib/multirepo/commands/clone-command.rb +67 -67
- data/lib/multirepo/commands/command.rb +89 -89
- data/lib/multirepo/commands/do-command.rb +100 -100
- data/lib/multirepo/commands/graph-command.rb +42 -42
- data/lib/multirepo/commands/init-command.rb +119 -119
- data/lib/multirepo/commands/install-command.rb +106 -106
- data/lib/multirepo/commands/merge-command.rb +225 -225
- data/lib/multirepo/commands/open-command.rb +55 -55
- data/lib/multirepo/commands/remove-command.rb +47 -47
- data/lib/multirepo/commands/uninit-command.rb +17 -17
- data/lib/multirepo/commands/update-command.rb +55 -55
- data/lib/multirepo/config.rb +15 -15
- data/lib/multirepo/files/config-entry.rb +38 -38
- data/lib/multirepo/files/config-file.rb +45 -45
- data/lib/multirepo/files/lock-entry.rb +28 -28
- data/lib/multirepo/files/lock-file.rb +55 -55
- data/lib/multirepo/files/meta-file.rb +40 -40
- data/lib/multirepo/files/tracking-file.rb +8 -8
- data/lib/multirepo/files/tracking-files.rb +46 -46
- data/lib/multirepo/git/branch.rb +31 -31
- data/lib/multirepo/git/change.rb +10 -10
- data/lib/multirepo/git/commit.rb +6 -6
- data/lib/multirepo/git/git-runner.rb +46 -46
- data/lib/multirepo/git/git.rb +9 -9
- data/lib/multirepo/git/ref.rb +37 -37
- data/lib/multirepo/git/remote.rb +16 -16
- data/lib/multirepo/git/repo.rb +122 -122
- data/lib/multirepo/hooks/post-commit-hook.rb +22 -22
- data/lib/multirepo/hooks/pre-commit-hook.rb +34 -34
- data/lib/multirepo/logic/dependency.rb +5 -5
- data/lib/multirepo/logic/merge-descriptor.rb +94 -94
- data/lib/multirepo/logic/node.rb +71 -71
- data/lib/multirepo/logic/performer.rb +56 -56
- data/lib/multirepo/logic/revision-selector.rb +34 -34
- data/lib/multirepo/multirepo-exception.rb +5 -5
- data/lib/multirepo/utility/console.rb +51 -51
- data/lib/multirepo/utility/runner.rb +34 -34
- data/lib/multirepo/utility/utils.rb +94 -94
- data/resources/.gitconfig +2 -2
- data/resources/post-commit +5 -5
- data/resources/pre-commit +5 -5
- data/spec/integration/init_spec.rb +18 -18
- data/spec/spec_helper.rb +89 -89
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ff5fa90b7325f5f997ce975839c229f9e027483
|
4
|
+
data.tar.gz: 85e5266dfdafb76b7a9a4360182138825eec3af3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e0869dde622b905daa713a5d5deed7b2043d047942dc014071815df88a0ebfa6840e1968fe3ea6794a9c114503a59b7a704457a492fb6d4c7cdc73867462cf
|
7
|
+
data.tar.gz: 0094423be10677e3ed047e4b8d1eb3e13c1fc8200fb964127fa6ef4a82d9b850d10e21378148bcf611f67277ebf854a12adabf79fb5ccd27da29ddd3096ccfad
|
data/.gitattributes
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
.multirepo.lock merge=ours
|
2
|
-
.multirepo.meta merge=ours
|
1
|
+
.multirepo.lock merge=ours
|
2
|
+
.multirepo.meta merge=ours
|
data/.gitbugtraq
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
[bugtraq "pivotal"]
|
2
|
-
url = https://www.pivotaltracker.com/story/show/%BUGID%
|
3
|
-
logRegex = (\\b\\d{8}\\b)
|
1
|
+
[bugtraq "pivotal"]
|
2
|
+
url = https://www.pivotaltracker.com/story/show/%BUGID%
|
3
|
+
logRegex = (\\b\\d{8}\\b)
|
data/.gitignore
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
/.config
|
4
|
-
/coverage/
|
5
|
-
/InstalledFiles
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/test/tmp/
|
9
|
-
/test/version_tmp/
|
10
|
-
/tmp/
|
11
|
-
|
12
|
-
## Specific to RubyMotion:
|
13
|
-
.dat*
|
14
|
-
.repl_history
|
15
|
-
build/
|
16
|
-
|
17
|
-
## Documentation cache and generated files:
|
18
|
-
/.yardoc/
|
19
|
-
/_yardoc/
|
20
|
-
/doc/
|
21
|
-
/rdoc/
|
22
|
-
|
23
|
-
## Environment normalisation:
|
24
|
-
/.bundle/
|
25
|
-
/lib/bundler/man/
|
26
|
-
|
27
|
-
# for a library or gem, you might want to ignore these files since the code is
|
28
|
-
# intended to run in multiple environments; otherwise, check them in:
|
29
|
-
# Gemfile.lock
|
30
|
-
# .ruby-version
|
31
|
-
# .ruby-gemset
|
32
|
-
|
33
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
-
.rvmrc
|
35
|
-
|
36
|
-
# Project-specific
|
37
|
-
/.multirepo
|
38
|
-
/.multirepo.lock
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
35
|
+
|
36
|
+
# Project-specific
|
37
|
+
/.multirepo
|
38
|
+
/.multirepo.lock
|
data/.multirepo.meta
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--- !ruby/object:MultiRepo::MetaFile
|
2
|
-
version: 1.0.0.
|
1
|
+
--- !ruby/object:MultiRepo::MetaFile
|
2
|
+
version: 1.0.0.beta41
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--color
|
2
|
-
--require spec_helper
|
1
|
+
--color
|
2
|
+
--require spec_helper
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in git-multirepo.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in git-multirepo.gemspec
|
4
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,42 +1,42 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
git-multirepo (1.0.0.beta38)
|
5
|
-
claide (~> 0.8, >= 0.8.0)
|
6
|
-
colored (~> 1.2)
|
7
|
-
os (~> 0.9.6)
|
8
|
-
ruby-graphviz (~> 1.2.1)
|
9
|
-
terminal-table (~> 1.4.5)
|
10
|
-
|
11
|
-
GEM
|
12
|
-
remote: https://rubygems.org/
|
13
|
-
specs:
|
14
|
-
claide (0.8.1)
|
15
|
-
colored (1.2)
|
16
|
-
diff-lcs (1.2.5)
|
17
|
-
os (0.9.6)
|
18
|
-
rake (10.4.2)
|
19
|
-
rspec (3.1.0)
|
20
|
-
rspec-core (~> 3.1.0)
|
21
|
-
rspec-expectations (~> 3.1.0)
|
22
|
-
rspec-mocks (~> 3.1.0)
|
23
|
-
rspec-core (3.1.7)
|
24
|
-
rspec-support (~> 3.1.0)
|
25
|
-
rspec-expectations (3.1.2)
|
26
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.1.0)
|
28
|
-
rspec-mocks (3.1.3)
|
29
|
-
rspec-support (~> 3.1.0)
|
30
|
-
rspec-support (3.1.2)
|
31
|
-
ruby-graphviz (1.2.2)
|
32
|
-
terminal-table (1.4.5)
|
33
|
-
|
34
|
-
PLATFORMS
|
35
|
-
ruby
|
36
|
-
x64-mingw32
|
37
|
-
|
38
|
-
DEPENDENCIES
|
39
|
-
bundler (~> 1.7)
|
40
|
-
git-multirepo!
|
41
|
-
rake (~> 10.0)
|
42
|
-
rspec (~> 3.1.0)
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
git-multirepo (1.0.0.beta38)
|
5
|
+
claide (~> 0.8, >= 0.8.0)
|
6
|
+
colored (~> 1.2)
|
7
|
+
os (~> 0.9.6)
|
8
|
+
ruby-graphviz (~> 1.2.1)
|
9
|
+
terminal-table (~> 1.4.5)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
claide (0.8.1)
|
15
|
+
colored (1.2)
|
16
|
+
diff-lcs (1.2.5)
|
17
|
+
os (0.9.6)
|
18
|
+
rake (10.4.2)
|
19
|
+
rspec (3.1.0)
|
20
|
+
rspec-core (~> 3.1.0)
|
21
|
+
rspec-expectations (~> 3.1.0)
|
22
|
+
rspec-mocks (~> 3.1.0)
|
23
|
+
rspec-core (3.1.7)
|
24
|
+
rspec-support (~> 3.1.0)
|
25
|
+
rspec-expectations (3.1.2)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.1.0)
|
28
|
+
rspec-mocks (3.1.3)
|
29
|
+
rspec-support (~> 3.1.0)
|
30
|
+
rspec-support (3.1.2)
|
31
|
+
ruby-graphviz (1.2.2)
|
32
|
+
terminal-table (1.4.5)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
x64-mingw32
|
37
|
+
|
38
|
+
DEPENDENCIES
|
39
|
+
bundler (~> 1.7)
|
40
|
+
git-multirepo!
|
41
|
+
rake (~> 10.0)
|
42
|
+
rspec (~> 3.1.0)
|
data/LICENSE
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2015 Michaël Fortin
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
22
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Michaël Fortin
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
CHANGED
@@ -1,144 +1,144 @@
|
|
1
|
-
# git-multirepo
|
2
|
-
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/git-multirepo.svg)](http://badge.fury.io/rb/git-multirepo)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/fortinmike/git-multirepo/badges/gpa.svg)](https://codeclimate.com/github/fortinmike/git-multirepo)
|
5
|
-
[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/fortinmike/git-multirepo/blob/master/LICENSE)
|
6
|
-
|
7
|
-
Track multiple Git repositories side-by-side.
|
8
|
-
|
9
|
-
An alternative approach to manage constantly evolving dependencies.
|
10
|
-
|
11
|
-
Check out [the project's to-do list](https://www.pivotaltracker.com/n/projects/1256156) to get an idea of upcoming enhancements.
|
12
|
-
|
13
|
-
You can download a handy cheat sheet [here](https://github.com/fortinmike/git-multirepo/raw/master/docs/git-multirepo-cheatsheet.docx).
|
14
|
-
|
15
|
-
## Motivation
|
16
|
-
|
17
|
-
By now the
|
18
|
-
[pitfalls](http://somethingsinistral.net/blog/git-submodules-are-probably-not-the-answer/)
|
19
|
-
of git submodules are
|
20
|
-
[pretty](https://codingkilledthecat.wordpress.com/2012/04/28/why-your-company-shouldnt-use-git-submodules/)
|
21
|
-
[well](http://slopjong.de/2013/06/04/git-why-submodules-are-evil/)
|
22
|
-
[known](http://stackoverflow.com/questions/12075809/git-submodules-workflow-issues).
|
23
|
-
They work when your dependencies are linearly-evolving third-party libraries that you seldom update but they fall apart when it comes to managing your own, constantly evolving dependencies.
|
24
|
-
|
25
|
-
Git subtrees are the recommended alternative but have pitfalls of their own:
|
26
|
-
|
27
|
-
- They require verbose and error-prone command-line operations. This can become quite tedious when managing more than one or two dependencies.
|
28
|
-
- They change the rules of the game when it comes to merges.
|
29
|
-
- Each developer has to configure the appropriate remotes and subtrees on his machine if he or she wants to contribute back.
|
30
|
-
- Developers must not forget to push changes to dependencies back to the appropriate remotes.
|
31
|
-
- Few git GUIs have any kind of subtree integration, so you're stuck with the command-line.
|
32
|
-
|
33
|
-
Etc.
|
34
|
-
|
35
|
-
## Overview
|
36
|
-
|
37
|
-
Using git-multirepo, you can manage your main project and its dependencies as completely independent repositories while still maintaining the ability to checkout a previous revision in a single step and have the project build properly.
|
38
|
-
|
39
|
-
A git-multirepo setup looks like this:
|
40
|
-
|
41
|
-
```
|
42
|
-
MyAwesomeProject
|
43
|
-
|-- AwesomeApp
|
44
|
-
|-- Dependency1
|
45
|
-
|-- Dependency2
|
46
|
-
```
|
47
|
-
|
48
|
-
In essence:
|
49
|
-
|
50
|
-
1. You tell git-multirepo what your dependencies are.
|
51
|
-
2. Each time you commit the main repo, git-multirepo tracks what revision of each dependency is required by the project (don't worry, it ensures that you don't forget to commit changes to dependencies beforehand; more on that later).
|
52
|
-
3. If you ever want to go back to a previous version of your project, git-multirepo handles checking out the main repo and appropriate revisions of all of its dependencies in a single, seamless operation.
|
53
|
-
4. Setting up the project on a new machine is only a single `multi clone` away.
|
54
|
-
|
55
|
-
## Example
|
56
|
-
|
57
|
-
Say you want to track an existing project with git-multirepo:
|
58
|
-
|
59
|
-
1. Organize repos on disk in the following manner:
|
60
|
-
|
61
|
-
```
|
62
|
-
MyAwesomeProject
|
63
|
-
|-- AwesomeApp
|
64
|
-
|-- Dependency1
|
65
|
-
|-- Dependency2
|
66
|
-
```
|
67
|
-
|
68
|
-
2. `cd` into the *AwesomeApp* directory (aka the "main repo").
|
69
|
-
3. Run `multi init`.
|
70
|
-
4. You will get prompted to add *Dependency1* and *Dependency2* to multirepo; do so.
|
71
|
-
5. git-multirepo reads all required information from dependency repos and initializes itself, storing its metadata in the main repo, under version control.
|
72
|
-
|
73
|
-
From now on, each time you commit the main repo git-multirepo tracks — using local git hooks — which revision of each dependency is required for that main repo revision, and where to get them. The hooks also ensure that you won't commit the main repo before its dependencies so that you always get a valid state stored under version control.
|
74
|
-
|
75
|
-
If you want to add another dependency later on, you can run `multi add ../NewDependency` and you can do the opposite with `multi remove ../SomeOtherDependency`.
|
76
|
-
|
77
|
-
If you want to checkout a previous revision (say `e690d`), you use the checkout command: `multi checkout e690d`. This will checkout the main repo's `e690d` revision and all of its dependencies with the proper revisions in detached HEAD state.
|
78
|
-
|
79
|
-
If you want to setup your project on another machine, simply run `multi clone` with the appropriate parameters. This will clone the project and each of its dependencies, then checkout the appropriate work branches.
|
80
|
-
|
81
|
-
If you want to stop using git-multirepo, run `multi uninit`. This will remove all traces of git-multirepo from your repository and working copy, including local git hooks.
|
82
|
-
|
83
|
-
## Advantages
|
84
|
-
|
85
|
-
- Makes setting up a project on a new machine a breeze.
|
86
|
-
- Really effective when working on multiple projects that share a common set of constantly evolving dependencies.
|
87
|
-
- Each dependency's repository is totally independent from the main repository, which simplifies a lot of things (merges, contributing upstream, etc.) and works well with git GUIs.
|
88
|
-
- While the repositories are independent, git-multirepo makes sure to track everything that's required to bring back a previous version of your project in a valid state.
|
89
|
-
- It supports sub-dependencies (e.g. dependencies that have dependencies of their own) so that you can bring back any subset of your project in a valid state at will.
|
90
|
-
- Much more approachable to novice developers than submodules or subtrees.
|
91
|
-
- Once setup, there is little need for git-multirepo commands, so you are free to use whatever tools you like to work with your git repos.
|
92
|
-
- Low possibility of human error (such as forgetting to contribute changes to dependencies back to the appropriate remotes, forgetting to commit dependencies in the proper order, etc.)
|
93
|
-
- You're not stuck with git-multirepo. It stores its metadata as [YAML](http://www.yaml.org) in the main repo. You can clone and checkout appropriate revisions of your dependencies by hand without git-multirepo if you need to. The information is there, in human-readable form.
|
94
|
-
|
95
|
-
| How It Handles... | git-multirepo | git submodules | git subtrees |
|
96
|
-
|----------------------------------|:----------------:|:--------------:|:------------:|
|
97
|
-
| Working Copy | beside main repo | in main repo | in main repo |
|
98
|
-
| Constantly Evolving Dependencies | easy | hard | passable |
|
99
|
-
| Merging Changes to Dependencies | easy | hard | passable |
|
100
|
-
| Contributing Upstream | easy | easy | passable |
|
101
|
-
| Continuous Integration | medium | medium | easy |
|
102
|
-
| Branch-Based Workflows | easy* | hard | easy |
|
103
|
-
|
104
|
-
(*) The `multi branch` and `multi merge` commands faciliate branching and merging the main repo and its dependencies as a whole.
|
105
|
-
|
106
|
-
## Limitations
|
107
|
-
|
108
|
-
- This tool should be considered beta at the moment.
|
109
|
-
- The tracked project and its dependencies must live beside each other on disk.
|
110
|
-
- You must install the tool on your CI server (`gem install git-multirepo`) and perform a `multi install` prior to checkout dependencies prior to building.
|
111
|
-
|
112
|
-
## Summary of Commands
|
113
|
-
|
114
|
-
Here is a quick rundown of commands available to you in git-multirepo:
|
115
|
-
|
116
|
-
| Command | Description |
|
117
|
-
|---------|-------------|
|
118
|
-
| init | Initialize the current repository as a multirepo project. |
|
119
|
-
| add | Track an additional dependency with multirepo. |
|
120
|
-
| branch | Create and/or checkout a new branch for all repos. |
|
121
|
-
| checkout | Checks out the specified commit or branch of the main repo and checks out matching versions of all dependencies. |
|
122
|
-
| clone | Clones the specified repository in a subfolder, then installs it. |
|
123
|
-
| do | Perform an arbitrary Git operation in the main repository, dependency repositories or all repositories. |
|
124
|
-
| graph | Graphs the dependency tree from the current repository. |
|
125
|
-
| install | Clones and checks out dependencies as defined in the version-controlled multirepo metadata files and installs git-multirepo's local git hooks. |
|
126
|
-
| merge | Performs a git merge on all dependencies and the main repo, in the proper order. |
|
127
|
-
| open | Opens repositories in the OS's file explorer. |
|
128
|
-
| remove | Removes the specified dependency from multirepo. |
|
129
|
-
| update | Force-updates the multirepo tracking files. |
|
130
|
-
| uninit | Removes all traces of multirepo in the current multirepo repository. |
|
131
|
-
|
132
|
-
To read more about each command, use the `--help` flag (e.g. `$ multi clone --help`).
|
133
|
-
|
134
|
-
## Metadata
|
135
|
-
|
136
|
-
git-multirepo stores all of its metadata in three files:
|
137
|
-
|
138
|
-
| File | Format | Updated | Contents |
|
139
|
-
|------|--------|---------|----------|
|
140
|
-
| .multirepo | YAML | at initialization | A collection of your project's dependencies. For each dependency, stores its **local path** relative to the main repo and the **remote URL** your project depends upon.
|
141
|
-
| .multirepo.lock | YAML | before each commit | For each dependency, stores the **commit id** and **branch** on which the dependency was when the main repo was committed. The dependency's **name** is also included but only serves as a reference to make inspecting the lock file easier. |
|
142
|
-
| .multirepo.meta | YAML | before each commit | Various git-multirepo metadata, such as the **git-multirepo version** that the last commit was performed with. |
|
143
|
-
|
1
|
+
# git-multirepo
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/git-multirepo.svg)](http://badge.fury.io/rb/git-multirepo)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/fortinmike/git-multirepo/badges/gpa.svg)](https://codeclimate.com/github/fortinmike/git-multirepo)
|
5
|
+
[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/fortinmike/git-multirepo/blob/master/LICENSE)
|
6
|
+
|
7
|
+
Track multiple Git repositories side-by-side.
|
8
|
+
|
9
|
+
An alternative approach to manage constantly evolving dependencies.
|
10
|
+
|
11
|
+
Check out [the project's to-do list](https://www.pivotaltracker.com/n/projects/1256156) to get an idea of upcoming enhancements.
|
12
|
+
|
13
|
+
You can download a handy cheat sheet [here](https://github.com/fortinmike/git-multirepo/raw/master/docs/git-multirepo-cheatsheet.docx).
|
14
|
+
|
15
|
+
## Motivation
|
16
|
+
|
17
|
+
By now the
|
18
|
+
[pitfalls](http://somethingsinistral.net/blog/git-submodules-are-probably-not-the-answer/)
|
19
|
+
of git submodules are
|
20
|
+
[pretty](https://codingkilledthecat.wordpress.com/2012/04/28/why-your-company-shouldnt-use-git-submodules/)
|
21
|
+
[well](http://slopjong.de/2013/06/04/git-why-submodules-are-evil/)
|
22
|
+
[known](http://stackoverflow.com/questions/12075809/git-submodules-workflow-issues).
|
23
|
+
They work when your dependencies are linearly-evolving third-party libraries that you seldom update but they fall apart when it comes to managing your own, constantly evolving dependencies.
|
24
|
+
|
25
|
+
Git subtrees are the recommended alternative but have pitfalls of their own:
|
26
|
+
|
27
|
+
- They require verbose and error-prone command-line operations. This can become quite tedious when managing more than one or two dependencies.
|
28
|
+
- They change the rules of the game when it comes to merges.
|
29
|
+
- Each developer has to configure the appropriate remotes and subtrees on his machine if he or she wants to contribute back.
|
30
|
+
- Developers must not forget to push changes to dependencies back to the appropriate remotes.
|
31
|
+
- Few git GUIs have any kind of subtree integration, so you're stuck with the command-line.
|
32
|
+
|
33
|
+
Etc.
|
34
|
+
|
35
|
+
## Overview
|
36
|
+
|
37
|
+
Using git-multirepo, you can manage your main project and its dependencies as completely independent repositories while still maintaining the ability to checkout a previous revision in a single step and have the project build properly.
|
38
|
+
|
39
|
+
A git-multirepo setup looks like this:
|
40
|
+
|
41
|
+
```
|
42
|
+
MyAwesomeProject
|
43
|
+
|-- AwesomeApp
|
44
|
+
|-- Dependency1
|
45
|
+
|-- Dependency2
|
46
|
+
```
|
47
|
+
|
48
|
+
In essence:
|
49
|
+
|
50
|
+
1. You tell git-multirepo what your dependencies are.
|
51
|
+
2. Each time you commit the main repo, git-multirepo tracks what revision of each dependency is required by the project (don't worry, it ensures that you don't forget to commit changes to dependencies beforehand; more on that later).
|
52
|
+
3. If you ever want to go back to a previous version of your project, git-multirepo handles checking out the main repo and appropriate revisions of all of its dependencies in a single, seamless operation.
|
53
|
+
4. Setting up the project on a new machine is only a single `multi clone` away.
|
54
|
+
|
55
|
+
## Example
|
56
|
+
|
57
|
+
Say you want to track an existing project with git-multirepo:
|
58
|
+
|
59
|
+
1. Organize repos on disk in the following manner:
|
60
|
+
|
61
|
+
```
|
62
|
+
MyAwesomeProject
|
63
|
+
|-- AwesomeApp
|
64
|
+
|-- Dependency1
|
65
|
+
|-- Dependency2
|
66
|
+
```
|
67
|
+
|
68
|
+
2. `cd` into the *AwesomeApp* directory (aka the "main repo").
|
69
|
+
3. Run `multi init`.
|
70
|
+
4. You will get prompted to add *Dependency1* and *Dependency2* to multirepo; do so.
|
71
|
+
5. git-multirepo reads all required information from dependency repos and initializes itself, storing its metadata in the main repo, under version control.
|
72
|
+
|
73
|
+
From now on, each time you commit the main repo git-multirepo tracks — using local git hooks — which revision of each dependency is required for that main repo revision, and where to get them. The hooks also ensure that you won't commit the main repo before its dependencies so that you always get a valid state stored under version control.
|
74
|
+
|
75
|
+
If you want to add another dependency later on, you can run `multi add ../NewDependency` and you can do the opposite with `multi remove ../SomeOtherDependency`.
|
76
|
+
|
77
|
+
If you want to checkout a previous revision (say `e690d`), you use the checkout command: `multi checkout e690d`. This will checkout the main repo's `e690d` revision and all of its dependencies with the proper revisions in detached HEAD state.
|
78
|
+
|
79
|
+
If you want to setup your project on another machine, simply run `multi clone` with the appropriate parameters. This will clone the project and each of its dependencies, then checkout the appropriate work branches.
|
80
|
+
|
81
|
+
If you want to stop using git-multirepo, run `multi uninit`. This will remove all traces of git-multirepo from your repository and working copy, including local git hooks.
|
82
|
+
|
83
|
+
## Advantages
|
84
|
+
|
85
|
+
- Makes setting up a project on a new machine a breeze.
|
86
|
+
- Really effective when working on multiple projects that share a common set of constantly evolving dependencies.
|
87
|
+
- Each dependency's repository is totally independent from the main repository, which simplifies a lot of things (merges, contributing upstream, etc.) and works well with git GUIs.
|
88
|
+
- While the repositories are independent, git-multirepo makes sure to track everything that's required to bring back a previous version of your project in a valid state.
|
89
|
+
- It supports sub-dependencies (e.g. dependencies that have dependencies of their own) so that you can bring back any subset of your project in a valid state at will.
|
90
|
+
- Much more approachable to novice developers than submodules or subtrees.
|
91
|
+
- Once setup, there is little need for git-multirepo commands, so you are free to use whatever tools you like to work with your git repos.
|
92
|
+
- Low possibility of human error (such as forgetting to contribute changes to dependencies back to the appropriate remotes, forgetting to commit dependencies in the proper order, etc.)
|
93
|
+
- You're not stuck with git-multirepo. It stores its metadata as [YAML](http://www.yaml.org) in the main repo. You can clone and checkout appropriate revisions of your dependencies by hand without git-multirepo if you need to. The information is there, in human-readable form.
|
94
|
+
|
95
|
+
| How It Handles... | git-multirepo | git submodules | git subtrees |
|
96
|
+
|----------------------------------|:----------------:|:--------------:|:------------:|
|
97
|
+
| Working Copy | beside main repo | in main repo | in main repo |
|
98
|
+
| Constantly Evolving Dependencies | easy | hard | passable |
|
99
|
+
| Merging Changes to Dependencies | easy | hard | passable |
|
100
|
+
| Contributing Upstream | easy | easy | passable |
|
101
|
+
| Continuous Integration | medium | medium | easy |
|
102
|
+
| Branch-Based Workflows | easy* | hard | easy |
|
103
|
+
|
104
|
+
(*) The `multi branch` and `multi merge` commands faciliate branching and merging the main repo and its dependencies as a whole.
|
105
|
+
|
106
|
+
## Limitations
|
107
|
+
|
108
|
+
- This tool should be considered beta at the moment.
|
109
|
+
- The tracked project and its dependencies must live beside each other on disk.
|
110
|
+
- You must install the tool on your CI server (`gem install git-multirepo`) and perform a `multi install` prior to checkout dependencies prior to building.
|
111
|
+
|
112
|
+
## Summary of Commands
|
113
|
+
|
114
|
+
Here is a quick rundown of commands available to you in git-multirepo:
|
115
|
+
|
116
|
+
| Command | Description |
|
117
|
+
|---------|-------------|
|
118
|
+
| init | Initialize the current repository as a multirepo project. |
|
119
|
+
| add | Track an additional dependency with multirepo. |
|
120
|
+
| branch | Create and/or checkout a new branch for all repos. |
|
121
|
+
| checkout | Checks out the specified commit or branch of the main repo and checks out matching versions of all dependencies. |
|
122
|
+
| clone | Clones the specified repository in a subfolder, then installs it. |
|
123
|
+
| do | Perform an arbitrary Git operation in the main repository, dependency repositories or all repositories. |
|
124
|
+
| graph | Graphs the dependency tree from the current repository. |
|
125
|
+
| install | Clones and checks out dependencies as defined in the version-controlled multirepo metadata files and installs git-multirepo's local git hooks. |
|
126
|
+
| merge | Performs a git merge on all dependencies and the main repo, in the proper order. |
|
127
|
+
| open | Opens repositories in the OS's file explorer. |
|
128
|
+
| remove | Removes the specified dependency from multirepo. |
|
129
|
+
| update | Force-updates the multirepo tracking files. |
|
130
|
+
| uninit | Removes all traces of multirepo in the current multirepo repository. |
|
131
|
+
|
132
|
+
To read more about each command, use the `--help` flag (e.g. `$ multi clone --help`).
|
133
|
+
|
134
|
+
## Metadata
|
135
|
+
|
136
|
+
git-multirepo stores all of its metadata in three files:
|
137
|
+
|
138
|
+
| File | Format | Updated | Contents |
|
139
|
+
|------|--------|---------|----------|
|
140
|
+
| .multirepo | YAML | at initialization | A collection of your project's dependencies. For each dependency, stores its **local path** relative to the main repo and the **remote URL** your project depends upon.
|
141
|
+
| .multirepo.lock | YAML | before each commit | For each dependency, stores the **commit id** and **branch** on which the dependency was when the main repo was committed. The dependency's **name** is also included but only serves as a reference to make inspecting the lock file easier. |
|
142
|
+
| .multirepo.meta | YAML | before each commit | Various git-multirepo metadata, such as the **git-multirepo version** that the last commit was performed with. |
|
143
|
+
|
144
144
|
The information contained in .multirepo and .multirepo.lock allow one-step cloning of a project and all its dependencies, and checking out any prior revision of the main project with appropriate revisions of all of its dependencies, respectively.
|