Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Git Version Control in ModusToolbox - KBA226845

Git Version Control in ModusToolbox - KBA226845

Community-Team
Employee
Employee
50 questions asked 10 questions asked 5 questions asked

Do the following to set up and use Git for an Eclipse project in ModusToolbox™:

 

Step1: Updating the Git plugin

 

ModusToolbox comes with Git (v4.8.0) integration by default. To get the latest plugin, use Help > Install New Software and add http://download.eclipse.org/egit/updates as shown:

pastedImage_0.png

The window that appears lists the available Git plugins that can updated/installed. Select the required plugins and click Next.

pastedImage_1.png

pastedImage_2.png

Follow the onscreen instructions, accept the license agreement, and complete the installation. Now, restart ModusToolbox for the changes to take effect.

Step 2: Adding projects to Git

 

Select the projects you want to add to Git by holding the Ctrl key down and right-clicking to choose Team > Share Project:

 

 

pastedImage_4.png

 

Please note: You need to be careful with what you check in to Git. Please refer to the section “Can I use an Eclipse IDE with a version control system?” at this link.

Now, click Create to create a new repository. Enter the directory of choice for the project files as shown below:

pastedImage_0.pngpastedImage_1.png

Note the target location where all the project files will be present as shown below. The project files will no longer be present in the workspace directory.

 

pastedImage_2.png

Click Finish. Note that all the project files now have Git status icon as shown below:

 

pastedImage_3.png

The NO-HEAD label indicates that the Git configuration is not yet complete. The subtle question mark symbol indicates that the projects are yet to be committed.

Step 3: Committing the files

 

Right-click the project files and select Team > Add to index.

 

pastedImage_4.png

 

You will observe all the question mark symbols now turn to a “+” symbol. This adds all the files to the staging area as shown below. If there are unstaged changes, it means the files haven’t been added to index yet. If you don’t see the staging area, go to Window > Show view > Other > Git > Git Staging.

 

pastedImage_5.png

Add a commit message to describe the changes. This will serve as a changelog for anyone viewing the files. Click Commit.

Step 4: Creating the online repository (optional if using internal VCS)

 

Create a public repository in any of the popular web hosting service for Git like Github or Bitbucket. Remember the credentials used to login to these sites. In this case, a repository named “Git_MT_Workspace” has been created.

Step 5: Pushing the files to online repository

 

Until now all the changes were done in the local repository. It’s time to push these changes to the online repository. Right-click the project files and select Team > Push. In the dialog prompt, add the URL to the repository and the credentials under Authentication. You can choose to check the box Store in secure store to remember the credentials for future use. Follow the onscreen instructions to push the files as illustrated below.

Please note: This is only for the first commit. For subsequent pushes, you can click “Commit and Push” in the “Git Staging” window.

 

pastedImage_6.png  pastedImage_7.png

 

pastedImage_8.png pastedImage_9.png

 

If there is a failure, the possible reasons for failure could be:

  • There were changes done online to the files and the current project is not up to date. To solve this, right-click the project files and select Pull. This will download all the latest files onto the project repository. If it says up to date as shown below, then you are in sync with the online repository. Now you can push the changes.
    pastedImage_11.png
  • Access restrictions might be in place for the online repository. Check with the web hosting service to make the access public or for means of authentication in case of a private repository. 
    pastedImage_12.png

If the push was successful, the files appear in the online repository along with the commit message.

 

pastedImage_13.png

 

Additional Information:

To track the changes done to the project, right-click the project files and select Team > Show in history. Selecting each commit gives details on the changes.

 

pastedImage_14.png

 

To compare the changes, click the “Compare Mode” symbol present in the History window.

pastedImage_15.png

 

Double-click the files to open the compare window.

pastedImage_16.png

Lastly, to disable version control, right-click the project files and select Team > Disconnect.

 

Author: DheerajK_81          Version: **

 

Translation - Japanese: ModusToolbox での Git バージョンコントロール - KBA226845- Community Translated (JA)

 

0 Likes
1272 Views