An overview at ../admin/reports/gitinfo of fundamental Git info for all repos, from the project root to the deepest Git directory it detects. It highlights what needs attention, in that case resulting in a warning.

It provides a quick insight for projects that contain one or more Git repositories. It is easier than searching for Git repos, then navigating to each of them in the terminal and executing long Git commands for each piece of info.

Compared with the terminal or IDE use of Git, it has the additional ability to:

  • render information as a link, for example, click on a commit hash to see the diff
  • show 'time ago' timestamps to see at a glance how long ago a commit was made
  • tell if your local branch is behind the remote by fetching automatically (optional)
  • pull automatically if there are no conflicts (optional) to keep your repos up-to-date
  • track projects outside the current one, also non-Drupal (local or on a server, optional).

Use cases

  • Keep track of all file changes in a development environment, especially when working with nested Git repos.
  • Monitor the production server for changes outside version control.
  • Track multiple projects by defining extra paths outside the project root, even those in a VM or non-Drupal projects (primary site should run natively on your OS). It is suggested to have one dedicated Drupal install to monitor multiple projects on the same server or machine.
  • Audit a Drupal project for Git related issues.
  • Learn more about Git by understanding the reported items of your own project.

Usage

  • Find the Git Info section in the Status Report at admin/reports/status with a summary.
  • Find the detailed info for all Git directories at admin/reports/gitinfo.
  • Settings can be configured at admin/config/development/gitinfo and the containing fields are self-explanatory.

Requirements

  • Git should be installed.
  • Unix based OS (Linux or OSX).
  • The shell_exec() PHP function has NOT been disabled in the php.ini. If it is disabled on your server you can still use the module for your local development only. On a common PHP install, it is normally allowed. On most hosting providers as well.
  • Having at least one directory under Git version control, preferably also the project root.

Optional but recommended

To get the most out of the Git report:

Upgrade

After upgrading, clear the site cache.

Provides per Git directory

  • remote URL (linked to the repository) and optionally a warning if the working directory is behind, actively making a connection with the remote repo
  • status: Current branch, untracked files and local file changes
  • the tag of the last stable version
  • last commit list dated (time ago) and with the commit hash that links to the commit and indicating which commits are ahead (local changes which are not present on the remote)
  • a list of commits on the remote that are not present on the local branch (behind)
  • status: The changed files and directories, neatly listed with a fuzzy timestamp (time ago)
  • ignored or skipped existing directories and files
  • the Git submodules it contains
  • list of stashes with a fuzzy timestamp (time ago) and stash name.

On your local development environment, changed files indicate you have to stage (with git add), commit or push your work. In the report, it is all pointed out.

If you find (not ignored) changed files on your server it usually means trouble (including hacking attempts) as they should all have been deployed under version control. The sites/*/files directory and similar are in the .gitignore file. It is recommended to have the complete Drupal project under Git version control to detect any changes. Use git init on it if this is not the case. It is usually one level above the Drupal root (the directory named web or docroot) and contains apart from that also the project's composer.json file and consequently the vendor directory.

How to define directories outside the project root

To track a non-Drupal project or to monitor multiple projects (also in VMs), read the documentation for instructions.

Troubleshooting

See documentation.

Setting it up only on the development environment

See documentation for instructions.

🇺🇦

This module is maintained by Ukrainian developers.
Please consider supporting Ukraine in a fight for their freedom and safety of Europe.
Supporting organizations: 
Development time
Development time and maintenance

Project information

Releases