Are you running Statamic Free version and want git support, but can't justify going getting Statamic Pro just for the git support?
Or maybe you're running Statamic Pro already, and you need more control over when, what and how changes get pushed back to your repo?
Gitamic adds an intuitive git UI to Statamic so that you can have more control over your commits.
It's great for solo sites where you want more granular control of your git history, but really shines on more complex sites that rely on live-publishing whilst pushing changes from your Statamic CP back to your git repository.
Features
Gitamic comes in two flavours: Basic and Pro. Both versions come with the following features:
- View the 'working tree'
- Stage and unstage changes (in bulk)
- Discard unstaged changes
- Commit staged changes
- Push to & pull from the remote branch
- See the commit history
Gitamic Pro features
Gitamic Pro unlocks the following extra super powers:
- File diffs
- And many more features coming soon!
Gitamic is under active development. If you can support this project by purchasing a Pro license, more features can come more quickly.
Requirements
- PHP 7.4+
- Statamic 3+ (running on Laravel 7+)
- git 2.30+
Installation and Setup
Statamic CP
Using the Statamic CP is the easiest way to install Gitamic. Under Tools > Addons, use the search to find 'Gitamic' and install. All done.
Composer
You can also install via Composer:
composer require simonhamp/gitamic
Once Composer has finished downloading the necessary dependencies, you'll need to update your application's
config/statamic/editions.php
to indicate that you're using the basic
edition of Gitamic:
'addons' => [
'simonhamp/gitamic' => 'basic',
],
Once Gitamic is installed, just refresh your CP and you can use it immediately. Even if your site hasn't been initialised with a git repository, you can use Gitamic to get started!
Setting the git committer
You can edit all of these settings and more in Gitamic > Settings!
By default, Gitamic uses the following details for the git committer name and email address:
- name:
Gitamic
- email:
[email protected]
You can easily override these values in your .env
by adding the following keys, e.g.:
GITAMIC_GIT_USER_NAME="Simon Hamp"
GITAMIC_GIT_USER_EMAIL="[email protected]"
If you're using Statamic Pro's Git Integration and would prefer Gitamic to use the same set of user details, simply set these values to
null
in youconfig/gitamic.php
or empty in your Gitamic Settings, and it will useSTATAMIC_GIT_USER_NAME
andSTATAMIC_GIT_USER_EMAIL
instead, if those are defined.
If you'd like to use the details of the logged-in Statamic user as the committer, you will need to enable the
gitamic.use_authenticated
option in config/gitamic.php
:
return [
'use_authenticated' => true,
'user' => ...
];
You will need to publish this config file to your site in order to make that change (this should already be done as part of the add-on's installation):
php artisan vendor:publish --provider=SimonHamp\\Gitamic\\ServiceProvider
Gitamic works with or without Statamic Pro
Gitamic does not require Statamic Pro, nor Statamic's Git Integration to be enabled.
If however you do have Statamic Pro and you have Statamic's Git Integration enabled, you may find it better to disable its 'automatic commits' feature so that Statamic doesn't automatically commit every change. This will leave you to do all your own commits via Gitamic, if that's what you're into.
To do this you can set the following key in your .env
file:
STATAMIC_GIT_AUTOMATIC=false
Auto-deployment
If you're using Gitamic on your auto-deployment target, when you push
it might trigger a redundant deployment back to
the environment where you've just committed those changes.
In your deployment script, you will need to write a statement that exits the deployment when it detects that Gitamic initiated the commit.
For example, if you use Laravel Forge and leave the GITAMIC_GIT_USER_NAME
as Gitamic
,
you could add the following to the beginning of your deploy script, which inspects the author of the commit and stops
the process before it begins:
[[ "$FORGE_DEPLOY_AUTHOR" == "Gitamic" ]] && echo "Commit by $FORGE_DEPLOY_AUTHOR" && exit 0
# The rest of your deployment script...
However, the specific approach you should use will depend largely on your setup.
Bugs and Feature Requests
If you experience any problems with Gitamic or would like to make a feature request, please raise an issue using the appropriate template.
You can also find me (@simonhamp) in the #3rd-party
channel on the Statamic Discord.
(Note that I will likely still ask you to fill out a GitHub issue).
Security
If you discover any security related issues, please do not raise an issue on GitHub. Email [email protected] instead.
Please note that I will not respond to feature requests or bug reports at this email address.
See SECURITY for more details.
License
Gitamic is a premium add-on, so a license is required for all versions. You may download and install it for free to trial it, but you must purchase a license code in order to use this add-on in production.
You can purchase a license code from the Statamic Marketplace.
See LICENSE.