Skip to content

Commit

Permalink
Improve README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Piechaczek committed Aug 20, 2018
1 parent 096f291 commit f17a9ce
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 12 deletions.
92 changes: 81 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ packages/
CLI options:

```
--recursive Whether to install dependencies recursively. Only packages matching
these patterns will be cloned recursively.
Default: false.
--packages Directory to which all repositories will be cloned.
--packages Directory to which all repositories will be cloned or are already installed.
Default: '<cwd>/packages/'
--resolver-path Path to a custom repository resolver function.
Expand Down Expand Up @@ -134,6 +130,8 @@ Examples:

### Recursive cloning

**Note**: `--recursive` option is a commands option, so remember about [`--`](https://unix.stackexchange.com/questions/147143/when-and-how-was-the-double-dash-introduced-as-an-end-of-options-delimiter) in order to separate options for mgit and specified command.

When the `--recursive` option is used mgit will clone repositories recursively. First, it will clone the `dependencies` specified in `mgit.json` and, then, their `dependencies` and `devDependencies` specified in `package.json` files located in cloned repositories.

However, mgit needs to know repository URLs of those dependencies, as well as which dependencies to clone (usually, only the ones maintained by you). In order to configure that you need to use a custom repository resolver (`--resolver-path`).
Expand All @@ -151,7 +149,7 @@ const parseRepositoryUrl = require( 'mgit2/lib/utils/parserepositoryurl' );
* Resolves repository URL for a given package name.
*
* @param {String} packageName Package name.
* @param {Options} data.options The options object.
* @param {Options} options The options object.
* @returns {Repository|null}
*/
module.exports = function resolver( packageName, options ) {
Expand Down Expand Up @@ -187,7 +185,7 @@ You can also use full HTTPS URLs to configure `dependencies` in your `mgit.json`
$ mgit [command]
```

For displaying help screen for commands, type:
For displaying help screen for specified command, type:

```bash
$ mgit [command] --help
Expand All @@ -202,7 +200,7 @@ This command will not change existing repositories, so you can always safely use
Example:

```bash
mgit bootstrap --recursive --resolver=path ./dev/custom-repository-resolver.js
mgit bootstrap --resolver=path ./dev/custom-repository-resolver.js -- --recursive
```

### update
Expand All @@ -216,7 +214,43 @@ This command does not touch repositories in which there are uncommitted changes.
Examples:

```bash
mgit update --recursive
mgit update -- --recursive
```

### pull

Pulls changes in existing repositories.

If any dependency is missing, the command will install it too.

Examples:

```bash
mgit pull -- --recursive
```

### push

Pushes changes in existing repositories.

If any dependency is missing, the command will not be executed.

Examples:

```bash
mgit push
```

### fetch

Fetches changes in existing repositories.

If any dependency is missing, the command will not be executed.

Examples:

```bash
mgit fetch
```

### exec
Expand All @@ -240,14 +274,50 @@ mgit exec 'echo `pwd`'
# /home/mgit/packages/organization/repository-2
```

### save-hashes
### commit (alias: `ci`)

For every repository that contains changes which can be committed, makes a commit with these files.
You need to specify the message for the commit.

Example:

```bash
mgit commit -- --message 'Introduce PULL_REQUEST_TEMPLATE.md.'

# Executes `git commit --message 'Introduce PULL_REQUEST_TEMPLATE.md.'` command on each repository.
# Commit will be made in repositories that "git status" returns a list if changed files (these files must be tracked by Git).
```

### merge

Requires a second argument which is a branch name that will be merged to current one. You can also specify the message
which will be added to the default git-merge message.

Repositories which do not have specified branch will be ignored.

Example:

```bash
# Assumptions: we are on "master" branch and "develop" branch exists.
mgit merge develop -- --message 'These changes are required for the future release.'

# Branch `develop` will be merged into `master`.
```

### save

Saves hashes of packages in `mgit.json`. It allows to easily fix project to a specific state.

Example:

```bash
mgit save-hashes
mgit save
```

If you would like to save name of branches instead of current commit, you can use an option `--branch`:

```bash
mgit save -- --branch
```

### status (alias: `st`)
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function handleCli() {
${ c( 'update' ) } Updates packages to the latest versions (pull changes and check out to proper branch).
${ u( 'Options:' ) }
${ y( '--packages' ) } Directory to which all repositories will be cloned.
${ y( '--packages' ) } Directory to which all repositories will be cloned or are already installed.
${ g( 'Default: \'<cwd>/packages/\'' ) }
${ y( '--resolver-path' ) } Path to a custom repository resolver function.
Expand Down

0 comments on commit f17a9ce

Please sign in to comment.