Git
The Git under allows the user to perform Git operations such as viewing remote repositories linked to the project and options to pull and push to the listed remote repositories. It also allows the user to add a remote repository to the project.
Below, we have a site mysweetdotcom with a link to a remote repository in GitHub:
Add a Repository
To add a remote repository for your site, click on the New Remote button. A Create Repository dialog will open where you’ll need to fill in the required information then click on the Create button and you should see the new repository added in the Remote Repositories
Note
For more information on errors that a user may encounter when using ssh keys with CrafterCMS, see Troubleshooting SSH Key Issues
Pull from Repository
To get updates from the remote repositories, click on the down arrow next to the remote repository you would like to pull changes from
You will then be given some options when Studio pulls from the remote repository:
Accept Ours: Accept the local’s version of the site and overwrite the remote version if different
Accept Theirs: Accept the remote’s version of the site and overwrite the local version if different
None: Studio will try to merge the remote version with the local version
Successful Pull From Repository
Since 4.0.0After making your selection, a notification at the bottom left of the screen will appear notifying the user of the successful pull, along with the merge commit id being copied to the clipboard and an option to publish it:
If the user opts to publish the commit id from the successful pull, open Publishing
under
, then scroll down to the Publish on Demand
section and select the publish by
tags/commit id radio button, then pasting the commit id copied to the clipboard from the successful pull.
Another way of publishing the commitd id from the successful pull is to click Yes
on the notification on the bottom left, then the Publish Commit
dialog will open
Conflict Resolution
When performing a pull from remote repository, Git is usually able to merge changes from the remote repository to your local files. Sometimes, a line you edited in a file may have also been edited on the remote repository which will result in a merge conflict when you pull from the remote repository. In this case, you will have to step in and tell Git what to do. Crafter Studio supports resolving the conflict from the Git
dashboard.
Note
Remember not to use Studio as a git merge and conflict resolution platform. All merge conflicts should be resolved upstream before getting pulled into Studio.
When you perform a pull from repository, and there’s a conflict between your local files and the remote repository files, the message Pull from remote repository resulted in conflict
will appear on the bottom left of the screen:
After the conflict message appears on the bottom left, to resolve the conflict, click on the Repository Status
tab. Here, you will then be presented with options on how to resolve the conflict
To cancel the pull operation, click on the Revert All
button:
To resolve the conflict, you are given two options:
Accept Remote: accept the changes from the remote repository and discard your local changes
Keep Local: keep your local changes and discard changes from the remote repository
Diff: let’s you view the differences between your local files and the files in the remote repository. Crafter Studio let’s you view the differences a couple of ways:
Select the appropriate button for your case, Keep Local
or Accept Remote
then click on Confirm
. You will then be directed to commit the changes done to your local or cancel the pull operation.
When committing your changes, you will then be asked to supply a message for the repository history log then click on the Commit Resolution
button and you’re done resolving the conflict
Push to Repository
To push your changes in Studio to a remote repository, click on the up arrow next to the remote repository you would like to push changes to
In the Push dialog, select the branch in the remote repository you’d like to push changes to