MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Add Git Submodules


To reuse code from another repository, you can specify Git submodules.

To clone an external Git repository as a submodule:

(^1) Right-click in the MATLAB Current Folder browser, and select Source Control >
Submodules.
(^2) In the Submodules dialog box, click the + button.
(^3) In the Add Submodule dialog box, in the Remote box, specify a repository location.
Optionally, click Validate.
(^4) In the Path box, specify a location for the submodule and click OK. The Submodules
dialog box displays the status and details of the submodule.
(^5) Check the status message, and click Close.
Use Fetch to Get Latest Submodule Version
When you want to manage the added submodule, open the Submodules dialog box.
(^1) To get the latest version of a submodule, in the Submodules dialog box, click Fetch.
(^2) After fetching, you must merge. Check the Status message in the Submodules dialog
box for information about your current branch relative to the remote tracking branch
in the repository. When you see the message Behind, you need to merge in changes
from the repository to your local branch.
3 Click Branches and merge in the origin changes to your local branch using the
Branches dialog box. See “Fetch and Merge” on page 32-46.
Use Push to Send Changes to the Submodule Repository
If you make changes in your submodule and want to send changes back to the repository:
(^1) Perform a local commit in the parent folder.
(^2) Open the Submodules dialog box and click Push.
If you want other users to obtain your changes in the submodule when they clone the
parent folder, make sure the index and head match.
(^1) In the Submodules dialog box, check the index and head values. The index points to
the head commit at the time you first cloned the submodule, or when you last
32 Source Control Interface

Free download pdf