Skip to content

Commit d92c121

Browse files
committed
Document how to use tags and branches when importing projects
1 parent 1a744b7 commit d92c121

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/tools/CLI/cli-create.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,29 @@ $ 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 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.
123+
124+
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:
125+
126+
```
127+
$ mbed import https://github.com/ARMmbed/mbed-os-example-blinky#mbed-os-5.11.0 my-blinky
128+
```
129+
130+
In this case, a directory named `my-blinky` will be created instead.
131+
132+
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.
133+
111134
### Updating programs and libraries
112135

113136
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)