LazGitGui

From Free Pascal wiki
Jump to navigationJump to search

Template:LazGitGui

LazGitGui is a graphical user interface for git. In some way, it tries to resemble the popular 'git gui' program but with some additions that allow you, with a glimpse, to get a general state of the repository.

If you don't know what 'git gui' is, it is a graphical representation of the git status, where one can do basic git operations like watch what files in the work space have been modified and see the differences with respect to the original files. It also allow move files between the unstaged and the staged area and make commits from it, and much more.

Git Gui has some cool features not yet available in this program, for example the selective apply or revert of hunk and line changes from the diff viewer.

Contrary to Git Gui which relies on gitk for that feature, LazGitGui has a log feature that allows you to see the history of the repository and do some operation on branches and commits.

Features

  • Clone a repository.
  • Handle remotes dialog.
  • State panel that shows current and upstream branches. Commits ahead and commits behind. Tag description.
  • User defined buttons to assign click and run git commands.
  • List of untracked and changed files, selecting a file shows its changes or if is untracked the file content. A context menu contain numerous features like:
    • Stage one, some or all files.
    • Restore one, some or all changed files.
    • Delete files.
    • Edit files in an internal or external editor.
    • Create a patch from the selection and save it to a file.
    • Show the file history.
    • Modify the ignore file with information of the selected file.
    • Show tracked and ignored files.
  • List of staged files ready to be committed.
  • Buttons for reload, fetch, pull, push and push with dialog.
  • Amend a commit.
  • A repository information button.
  • A Log window listing commits with the following features:
    • Filter or Search commits by multiple terms.
    • Show the changes made by a commit.
    • Show the repository tree at some commit in history, this helps to check what was the content of certain file at some commit in particular.
    • Show the file history of the selected file.
    • Show the graph detailing the relationship between commits.
    • Regular expression rules for matching bug, commit and URL links in commit subject (commit links are valuable for pointing at previous commits in history).
  • The log window context menu has the following features:
    • Go to the checked out commit (HEAD or Detached HEAD), go to parent or child commit.
    • Create a tag a this commit.
    • Delete tags.
    • Switch to a tag.
    • Create a branch a this commit.
    • Switch to a branch.
    • Delete local and remote branches.
    • Start a Rebase on top of the selected commit.
    • Cherry Pick this commit.
    • Revert this commit.
    • Merge.
    • Start a Bisect operation by selecting a pair of commits.
    • Reset current branch to a commit.
    • Switch to a commit.
    • Copy commit information: full, sha, subject, etc.
  • Other features:
    • Lock to start directory. While launching LazGitGui with the --locked argument, it will show the repository restricted to the given directory instead of the whole repository.
    • Dropping a patch file in LazGitGui allows to apply the patch to the repository (no commit is created by this operation).
    • The log window title show information about the repository state.
    • Git state and links to actions. LazGitGui now detects if the repository is doing any of the following operations in some intermediate state: Rebase, Cherry pick, Revert, Merge and Bisect. It will show some options for taking a corresponding action, here an example of a rebase with conflicts: Rebase in conflict state

Screenshots

Status Screen lazgitgui main.png

Log Screen lazgitgui log.png

File History Screen lazgitgui filehistory.png

Download

Clone from the LazGitGui repository

Documentation

The following are extracts from the documentation available in the docs/documentation.md file

Building LazGitGui

At the moment there are no binary releases available so the program has to be compiled and used from the compiling directory.

This is a Lazarus/Free Pascal program so you will need Lazarus in order to compile it, a standard install will be enough as LazGitGui does not use special packages.

The most recent Lazarus release should be fine but if it's not please let me know.

In Lazarus, open the project file lazgitgui.lpi and compile it.

How to use

LazGitGui can use a supplied path passed as the last parameter in the command line, it can be a directory or a file residing within the working area of the repository at any level, if a path is not specified it will use the current working directory. Some suggestions for invoking LazGitGui:

From Lazarus, an external tool can be configured with the following properties:

(Linux + Windows)

Title: LazGitGui
Program Filename: PATH/TO/LazGitGui executable
Parameters: --logfile=PATH/TO/LazGitGui/ide.log $EdFile()
Shortcut: CTRL+ALT+G

(macOS)

Title: LazGitGui
Program Filename: open
Parameters: -a PATH/TO/LazGitGui.app --args --logfile=PATH/TO/LazGitGui/ide.log $EdFile()
Shortcut: CMD + G

The logfile parameter is optional.

Requirements

LazGitGui only requires the git program, any version since 1.9.0 should work.

The program tries automatically to find the git executable in the system (or user) path, once located, it gets stored in the LazGitGui config file. LazGitGui does this only once, the next time the program is started, the git executable path is read from the config file.

In the case that LazGitGui was unable to locate the git program, or if one specific version of git is needed and because at the moment LazGitGui does not have a config screen, you have two options: Use the command line or edit the config file:

Editing the config file

The config file can be found in the following locations:

Windows:    %LOCALAPPDATA%\appdata\lazgitgui\config\lazgitgui.cfg.json
Linux/mac:  $HOME/.config/lazgitgui\lazgitgui.cfg.json

for example (this works under Linux):

{
...
"lazgitgui.cfg" : { "git" : "/usr/bin/git" },
...
}

Using the command line

use the --git parameter to enter the git executable location:

--git=PATH/TO/GIT_EXECUTABLE.

Modes

By default, LazGitGUI will start full mode with the [[|Status Screen].

If the -l or --log argument is supplied it will be launched in the Standalone Log mode where only the log window will be displayed.

If the -f <file> or --filehistory=<file> argument is supplied, it will be run in File History mode which shows all the changes of the given file. In this case <file> have to be an existing tracked file within the working area, if<file> is not supplied it exists with an error.

Report issues

Please file a report in the bug tracker