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 Desktop:
- Open Martini Desktop:
-
Go to
File
>>Switch Workspace
>>Other
. -
Specify Workspace Path:
-
Enter the path for your new workspace (e.g.,
/my-workspace
) and clickLaunch
. -
Access the Git Perspective:
-
Once the workspace loads, switch to the Git perspective by clicking the Git icon on the top right.
-
Verify Repository:
- You will see an empty Git repository without any commits in the Git perspective view.
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 Git icon on the top right.
-
Add a Remote:
- Navigate to
Git Repositories
>>Remotes
. - Right-click and select
Create Remote
. -
Click
Configure Fetch
and thenCreate
. -
Enter Remote URI:
- Copy the URI of the remote repository (e.g., from Bitbucket).
-
Click
Change
in Martini Desktop and paste the URI. ClickFinish
andSave
. -
Fetch and Reset:
- Right-click on the repository and select
Fetch from Origin
. - Go to
Branches
,Remote Tracking
, right-click on the master branch, and selectReset
. -
Choose
Hard Reset
and clickFinish
. -
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:
- Configure Remote for Fetching:
- Right-click on
Origin
and clickConfigure Fetch
. -
Map your local branch to its remote branch by adding the branch name.
-
Fetch from Remote:
- Right-click on the repository and select
Fetch from Origin
. -
Check the number of commits to pull (indicated by a down arrow).
-
Compare and Pull:
- Use the
History
view to compare the remote commits with local changes. -
Right-click on the repository and select
Pull
to fetch and merge changes. -
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
Git Staging
view. - Stage files by selecting them and clicking the green plus button.
-
Write a commit message and click
Commit
. -
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:
- Right-click on the file and select
Compare with Index
to view differences between versions.
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 Desktop, go to the
Git Repositories
view. - Right-click on
Remote
and selectCreate Remote
. -
Configure the push by pasting the SSH URL and click
Finish
, thenSave
. -
Push Branch:
- Right-click on the branch you want to push and select
Push Branch
. -
Click
Preview
and thenPush
. -
Verify Push:
-
Refresh your remote repository page to ensure the files and commits are visible.
-
Push Additional Commits:
- Make changes, stage and commit them.
- Use the
Commit and Push
button for a combined commit and push operation.