Skip to content
Tutorials Center
My learning

Topics

Git Reference ยท Maintenance and Recovery

git bugreport command

Reference for git bugreport: generate a text template with your Git version, platform details and enabled hooks, choose the output folder and add diagnostics.

git bugreport creates a text file that you can paste into an email to the Git mailing list. It starts with a short questionnaire (what you did, what you expected, what happened) and then appends the facts developers always ask for: the output of git version --build-options, the shell path, and the names of the hooks that are active in the current repository.

The command only collects local information; it sends nothing anywhere. You edit the file, remove anything private and then send it yourself. It works inside or outside a repository, but the hook list is only filled in when run in one.

Terminal
git bugreport
git bugreport -s mybug -o ~/reports

Try it

Bash Create a report and look at its sections

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash Output folder and diagnostics archive

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]
              [--no-diagnose | --diagnose[=<mode>]]
Option Description
-o <path>, --output-directory <path> Directory for the report. It is created if it does not exist. The default is the current directory.
-s <format>, --suffix <format> Text appended to the file name: git-bugreport-<suffix>.txt. It is passed through strftime, so %Y-%m-%d is allowed. The default is %Y-%m-%d-%H%M.
--diagnose[=<mode>] Also run git diagnose and save a zip named git-diagnostics-<suffix>.zip next to the report. Mode stats (default) collects statistics and configuration; all adds more data, such as the contents of .git/ bookkeeping files.
--no-diagnose Do not create the archive (the default).

Returns: prints Created new report at '<file>'. on standard error and exits 0. If a file with that name already exists, it fails with an error and writes nothing.

Usage notes

  • File name collisions. The default suffix has minute precision. Two reports in the same minute collide, so pass -s for scripted use.
  • What is in [System Info]. Git version and build options (commit, CPU, sizeof-long, sizeof-size_t, shell-path). Your user name and repository path are not added, but check the file before you send it.
  • Hooks. The [Enabled Hooks] section lists hook files that are executable, which is useful because a hook is a common cause of strange behavior. Hooks that come from core.hooksPath are included.
  • Review first. The report is a template: fill in the four questions. A good report names the exact commands, the Git version and a minimal repository that reproduces the problem; commands like GIT_TRACE=1 git <command> help too, see GIT_TRACE.
  • Where to send it. The Git project takes bug reports on its mailing list ([email protected]); Git for Windows and other distributors have their own trackers.
  • Diagnostics are metadata only. The zip contains file lists, pack and index statistics and copies of selected config and log files, not your source files, but it can contain remote URLs and branch names. Read it before sharing.