Skip to content

Document how to use tags and branches when importing projects #1030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/tools/CLI/cli-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,27 @@ $ mbed compile -t ARM -m K64F --source project2 --source mbed-os --build BUILD/p

Find more details on the `--source` switch in the [build rules documentation](../reference/mbed-os-build-rules.html).

### Importing a program

You can import an existing program by using the `mbed import` command.

```
$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky#mbed-os-5.11.0
[mbed] Working path "C:\dev" (directory)
[mbed] Importing program "mbed-os-example-blinky" from "https://github.com/ARMmbed/mbed-os-example-blinky" at branch/tag "mbed-os-5.11.0"
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os" at rev #6a0a86538c0b
```

You can specify which version to import using `#` followed by a commit hash, a branch name, or a tag name. If you do not provide any of these (nor the `#` character), the latest commit on the `master` branch will be imported.

A project's default name is the last part of the URL (excluding `#` and its value). In the example above, the imported program's project folder is `mbed-os-example-blinky`. To specify a different name, supply it as an extra positional argument in the import command. For example, to name your project `my-blinky`, run:

```
$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky#mbed-os-5.11.0 my-blinky
```

<span class="tips">**Tip**: Running `mbed import` within an existing program will result in an error. To add a library to an existing project, use the `mbed add` command.</span>

### Updating programs and libraries

You can update programs and libraries on your local machine, so they update to the latest released version from the remote sources (Git or Mercurial).
Expand Down