This module performs common GIT tasks by calling git as a remote process
through process_create/3. It requires that the
git executable is in the
This module started life in ClioPatria and has been used by the Prolog
web-server to provide information on git repositories. It is now moved
into the core Prolog library to support the Prolog package manager.
- git(+Argv, +Options) is det
- Run a GIT command. Defined options:
- Execute in the given directory
- Unify Out with a list of codes representing stdout of the
command. Otherwise the output is handed to print_message/2
output(Out), but messages are printed at level
- Export GIT_ASKPASS=Program
- close_streams(+Streams:list) is det[private]
- Close a list of streams, throwing the first error if some stream
failed to close.
- git_process_output(+Argv, :OnOutput, +Options) is det
- Run a git-command and process the output with OnOutput, which is
- git_open_file(+GitRepoDir, +File, +Branch, -Stream) is det
- Open the file File in the given bare GIT repository on the given
- - We cannot tell whether opening failed for some reason.
- is_git_directory(+Directory) is semidet
- True if Directory is a git directory (Either checked out or
- git_describe(-Version, +Options) is semidet
- Describe the running version based on GIT tags and hashes.
- Only use tags that match Pattern (a Unix glob-pattern; e.g.
- Provide the version-info for a directory that is part of
- Describe Commit rather than
- See also
- - git describe
- git_is_clean(+Dir) is semidet[private]
- True if the given directory is in a git module and this module
is clean. To us, clean only implies that
git diff produces
- git_hash(-Hash, +Options) is det
- Return the hash of the indicated object.
- git_ls_tree(-Entries, +Options) is det
- True when Entries is a list of entries in the the GIT
repository, Each entry is a term:
object(Mode, Type, Hash, Size, Name)
- git_remote_url(+Remote, -URL, +Options) is det
- URL is the remote (fetch) URL for the given Remote.
- git_ls_remote(+GitURL, -Refs, +Options) is det
git ls-remote against the remote repository to fetch
references from the remote. Options processed:
For example, to find the hash of the remote
HEAD, one can use
Refs = ['5d596c52aa969d88e7959f86327f5c7ff23695f3'-'HEAD'].
|Refs||- is a list of pairs hash-name.|
- git_remote_branches(+GitURL, -Branches) is det
- Exploit git_ls_remote/3 to fetch the branches from a remote
repository without downloading it.
- git_default_branch(-BranchName, +Options) is det
- True when BranchName is the default branch of a repository.
- git_branches(-Branches, +Options) is det
- True when Branches is the list of branches in the repository.
In addition to the usual options, this processes:
- Return only branches that contain Commit.
- git_tags_on_branch(+Dir, +Branch, -Tags) is det
- Tags is a list of tags in Branch on the GIT repository Dir, most
recent tag first.
- See also
- - Git tricks at http://mislav.uniqpath.com/2010/07/git-tips/
- git_shortlog(+Dir, -ShortLog, +Options) is det
- Fetch information like the GitWeb change overview. Processed
- Maximum number of commits to show (default is 10)
- Git revision specification
- Only show commits that affect Path. Path is the path of
a checked out file.
- Similar to
path, but Path is relative to the repository.
|ShortLog||- is a list of |
- git_show(+Dir, +Hash, -Commit, +Options) is det
- Fetch info from a GIT commit. Options processed:
- GIT option on how to format diffs. E.g.
- Truncate the body at Count lines.
|Commit||- is a term |
git_commit(...)-Body. Body is currently
a list of lines, each line represented as a list of
- git_format_string(:Record, -FieldNames, -Format)[private]
- If Record is a record with fields whose names match the GIT
format field-names, Format is a git
--format= argument with
the appropriate format-specifiers, terminated by %x00, which
causes the actual field to be 0-terminated.
The following predicates are exported, but not or incorrectly documented.
- git_commit_data(Arg1, Arg2, Arg3)
- git_log_data(Arg1, Arg2, Arg3)