Skip to content

Commit ed5a629

Browse files
authored
Merge pull request #1030 from bridadan/mbed_import_tags
Document how to use tags and branches when importing projects
2 parents 340ef3a + 82a75bf commit ed5a629

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/tools/CLI/cli-create.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,27 @@ $ mbed compile -t ARM -m K64F --source project2 --source mbed-os --build BUILD/p
108108

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

111+
### Importing a program
112+
113+
You can import an existing program by using the `mbed import` command.
114+
115+
```
116+
$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky#mbed-os-5.11.0
117+
[mbed] Working path "C:\dev" (directory)
118+
[mbed] Importing program "mbed-os-example-blinky" from "https://github.com/ARMmbed/mbed-os-example-blinky" at branch/tag "mbed-os-5.11.0"
119+
[mbed] Adding library "mbed-os" from "https://github.com/ARMmbed/mbed-os" at rev #6a0a86538c0b
120+
```
121+
122+
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.
123+
124+
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:
125+
126+
```
127+
$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky#mbed-os-5.11.0 my-blinky
128+
```
129+
130+
<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>
131+
111132
### Updating programs and libraries
112133

113134
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).

0 commit comments

Comments
 (0)