NAME

archives2git - generate a Git history from a series of release tarballs

SYNOPSIS

archives2git [options] [--] archives_and_directories

DESCRIPTION

archives2git replaces the contents of a Git repository subdir with that of an archive file (or of another directory) and commits the changes.

OPTIONS

The options are parsed by git-rev-parse(1) with the option --parseopt.

--repo=

work tree subdir

--rename=

sh code to rename the current $file of the root

--keep-filter=

sh code to decide whether to ignore the current $file of the root

--gitadd-arg=

argument to pass to git-add

--date=

sh code printing the commit author date for the current $arch

--author=

sh code printing the commit author name for the current $arch

--title=

sh code printing the commit title (and an optional body start)

--body=

string appended to the title as a new paragraph

--gitci-arg=

argument to pass to git-commit

--gitfilter=

line separated arguments to pass to git-filter

--tag

tag the commits with the default tagname

--tagname=

tag the commits with the name printed by the given sh code

--command=

sh code to eval after having commited and tagged

--debug

enable the verbose printing of what is done

-h, --help

print a usage message and exit

--helpm

print the manual and exit

--man

view the manual in the pager and exit

--version

print the version information and exit

SHELL VARIABLES

The following shell variables are usable if appropriate in the shell code snippets passed as command line options: $arch, $archdir, $archname, $file, $date, $author, $title, $tagname.

SHELL FUNCTIONS

The following shell functions are defined in the script and are usable the the shell code snippets: get_version(filename).

ENVIRONMENT

GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL

FILES

~/.archives2gitrc

This file is sourced by the script. An example file is distributed.

EXAMPLES

Some possible options:

  $ archives2git $(ls ../oldproject-*.tgz | sort -V) \
    # keep (only) the .gitignore file
    --keep-filter 'test x.gitignore = x"$file"'
    --keep-filter 'echo "$file" | grep -q -f $HOME/filepats'
    # suppress the version info from the root directory in the archive
    --rename 'echo "${file%-*}"'
    # allow to add ignored files
    --gitadd-arg -f
    # use the archive modification time as the author date (with GNU date)
    --date 'LC_ALL=C date -r "$arch"'
    # do not include the path components in the commit title
    --title 'echo "${arch##*/}"'
    # interactively edit each commit message
    --gitci-arg "--edit"
    # keep only the files of the project in the root of the tree
    --gitfilter $'--subdirectory-filter\noldproject'
    # move the project's files out of their subdir (while keeping other files)
    --gitfilter $'--tree-filter\nmv oldproject/.* .; mv oldproject/* .'

See also the example configuration file.

AUTHOR

archives2git was written by G.raud Meyer.

SEE ALSO

git-commit-tree(1), git_load_dirs(1), git-rev-parse(1)