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 1 commit
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
23 changes: 23 additions & 0 deletions docs/tools/CLI/cli-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,29 @@ $ 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 change what version of the program is imported by changing what comes after the `#` character. You may supply 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 is imported.

A project is named after the last part of the URL by default. In the above example, a directory named `mbed-os-example-blinky` will be created to contain the imported program. If you wish to change the name of the project while importing, you can do this by supplying it as an extra positional argument:

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

In this case, a directory named `my-blinky` will be created instead.

Running `mbed import` within an existing program will result in an error. If you wish to add a library to an existing project, you can use the `mbed add` command in a similar manner.

### 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