archives2git - generate a Git history from a series of release tarballs
archives2git [options] [--] archives_and_directories
archives2git replaces the contents of a Git repository subdir with that of an archive file (or of another directory) and commits the changes.
The options are parsed by git-rev-parse(1) with the option --parseopt.
work tree subdir
sh code to rename the current $file of the root
sh code to decide whether to ignore the current $file of the root
argument to pass to git-add
sh code printing the commit author date for the current $arch
sh code printing the commit author name for the current $arch
sh code printing the commit title (and an optional body start)
string appended to the title as a new paragraph
argument to pass to git-commit
line separated arguments to pass to git-filter
tag the commits with the default tagname
tag the commits with the name printed by the given sh code
sh code to eval after having commited and tagged
enable the verbose printing of what is done
print a usage message and exit
print the manual and exit
view the manual in the pager and exit
print the version information and exit
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.
The following shell functions are defined in the script and are usable the the shell code snippets: get_version(filename).
This file is sourced by the script. An example file is distributed.
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.
archives2git was written by G.raud Meyer.
git-commit-tree(1), git_load_dirs(1), git-rev-parse(1)