Gitamic

Simon Hamp

Are you running Statamic Free version and want git support, but can't justify going Pro?

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 more complex sites that rely on live-publishing changes from your Statamic CP back to your git repository.

Features

  • View the 'working tree'
  • Stage and unstage changes
  • Discard unstaged changes
  • Commit staged changes
  • Push to & pull from the remote branch

And even more features are coming as Gitamic is under active development!

Pro version COMING SOON with...

  • Diffs
  • Commit history
  • Stashing
  • Restoring

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. It relies on wherever your site is running to contain a git repository.

Setting the git committer

By default, Gitamic uses the following details for the git committer name and email address:

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]"

When using Statamic Pro's Git Integration, if the above keys aren't defined, Gitamic will fallback on STATAMIC_GIT_USER_NAME and STATAMIC_GIT_USER_EMAIL, if those are defined.

If you'd like to use the details of the logged-in 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:

php artisan vendor:publish --provider=SimonHamp\\Gitamic\\ServiceProvider

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.

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