Configuring Git in Martini Designer
This guide provides a comprehensive overview of configuring and using Git in Martini Designer, including creating repositories, cloning, pulling, committing, and pushing changes.
Best Practice
It is recommended to have one Git repository per Workspace in Martini Desktop or Martini Online for optimal organization and management.
Creating a Git Repository
To create a Git repository in Martini Designer:
-
Open Martini Desktop:
- Go to
File
>>Switch Workspace
>>New/Existing workspace
.
- Go to
-
Specify Workspace Path:
- Enter the path for your new workspace (e.g.,
/my-workspace
) and click Enter.
- Enter the path for your new workspace (e.g.,
-
Access the Git Perspective:
- Once the workspace loads, switch to the Git perspective by clicking the Git or Source Control icon in the sidebar.
Cloning a Remote Repository
To clone a remote repository into your workspace:
-
Shut Down Martini Runtime (if it's running).
-
Open the Git Perspective:
- Click the Source Control icon located in the sidebar.
-
Add a Remote:
- Click the
Clone
button beside thePush
button.
- Click the
-
Enter Remote URI:
- Copy the URI of the remote repository (e.g., from Bitbucket) and specify the branch you want to clone.
- You can choose to clone using
SSH
orHTTPS
. Ensure SSH keys are correctly configured if using SSH.
-
Fetch and Reset:
- After cloning, access the Git menu by clicking the three-dot menu.
- Navigate to
Pull, Push
and selectFetch...
to choose a remote repository and fetch changes.
-
Verify Files:
- Go to the Designer perspective, start Martini Runtime, and check if the files are present.
Pulling Commits from a Remote Repository
To fetch and pull commits from a remote repository:
-
Access Source Control options:
- Click the Source Control icon on the sidebar and open the three-dot menu.
- You will find all Git commands including
Pull
andFetch
-
Fetch from Remote:
- Select the
Fetch
option to retrieve the latest changes from the remote repository without applying them locally.
- Select the
-
Compare and Pull:
- Use the
Pull
orPull From
command (available in the three-dot menu) to merge the remote changes into your local repository. - Open the
History
view to review and compare remote commits with your local changes.
- Use the
-
Verify Changes:
- Go to the Designer perspective and check if the updates are reflected.
Committing Changes
To commit files to your Git repository:
-
Create and Save Files:
- Create a package and service, then save them.
-
Stage and Commit:
- Go to the Git perspective and open the staging view.
- Stage files by selecting them and clicking the plus button.
- Write a commit message and click the
Commit
button (the Check icon).
-
Modify and Commit:
- Make changes to files (e.g., update service logic), save, and stage the changes.
- Write a commit message describing the modifications and click
Commit
.
-
Compare Versions:
- Look for files marked with a yellow M icon, indicating they have been modified.
- Click the history icon located in the sidebar then select a commit to view the changes. This will open a comparison view, allowing you to review differences between the current version and the previous version.
Pushing Commits to a Remote Repository
To push commits from your local repository to a remote repository:
-
Add Remote Repository:
- Copy the SSH URL of your remote repository.
- In Martini Designer, go to Source Control.
- Click the
Clone
button and input the SSH URL of your remote repository. - Configure the repository by clicking
Save
.
-
Push Branch:
- Click the
Push
button (an arrow up icon) to push commits. - You can also push by using
Push from
under the three-dot menu.
- Click the
-
Verify Push:
- Refresh your remote repository page to ensure the files and commits are visible.