Skip to content

Alternative to --no-history #126

@framillien

Description

@framillien

I use ghp-import with a variable prefix, to keep a disctinct doc folder by release and one for all nightly updates, like:

# version = 'latest' or a semver version
ghp-import --prefix=${version}  -m 'Update ${version}' --push doxygen_html

As you expect, without --no-history this repo growth out of control, but I need to keep data for each releases. I end up with a git-filter to squash commits from nightly builds, like:

ghp-import --prefix=${version} -m 'Update ${version}' doxygen_html
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --force --commit-filter '
    if [ "$(git rev-parse gh-pages)" != "$GIT_COMMIT" ] && [ $(git show -s --format=%B "$GIT_COMMIT" | grep -c "Update latest") -gt 0 ]
    then
        skip_commit "$@";
    else
        git commit-tree "$@";
    fi' gh-pages
git push origin +gh-pages

This command merge all commits with a common commit message the result is:

  • We keep all data, but not all commits, my releases folders are safe.
  • Repo size stay low because we squash all commits related to a nightly build

I wonder if this kind of commit squash command could be added to ghp-import as an alternative to --no-history. In the simplest form we can squash all commits of the branch without bother about commit message, or we can try to keep some ways to choose which commits should be squashed.

Could be:

-a, --squash-history      Squash commits, keeping data. If --message param
                          is set, filtering squashed commits on this commit
                          message, else squash all commits in the branch.
                          Act like `--no-history` but without discarding data.

ghp-import --prefix=${version}  -m 'Update ${version}' --push --squash-history doxygen_html

Note: -a to keep -q for potential --quiet parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions