{"id":15360592,"url":"https://github.com/tkf/git-blackhole","last_synced_at":"2025-04-15T08:22:27.686Z","repository":{"id":57434423,"uuid":"114077107","full_name":"tkf/git-blackhole","owner":"tkf","description":"Continuous backup and recoverable trash can for Git","archived":false,"fork":false,"pushed_at":"2020-09-26T02:56:56.000Z","size":196,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T18:09:20.642Z","etag":null,"topics":["backup","cli","git"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkf.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-13T05:17:04.000Z","updated_at":"2021-09-02T02:38:57.000Z","dependencies_parsed_at":"2022-09-04T15:30:35.150Z","dependency_job_id":null,"html_url":"https://github.com/tkf/git-blackhole","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkf%2Fgit-blackhole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkf%2Fgit-blackhole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkf%2Fgit-blackhole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkf%2Fgit-blackhole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkf","download_url":"https://codeload.github.com/tkf/git-blackhole/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248679123,"owners_count":21144408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","cli","git"],"created_at":"2024-10-01T12:50:52.224Z","updated_at":"2025-04-15T08:22:27.668Z","avatar_url":"https://github.com/tkf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===========================================================================\n ``git-blackhole`` --- Continuous backup and recoverable trash can for Git\n===========================================================================\n\n|logo|\n\n    Logo by `@reallinfo \u003chttps://github.com/reallinfo\u003e`_.  The logo is\n    licensed under a `Creative Commons Attribution 4.0 International\n    License \u003chttps://creativecommons.org/licenses/by/4.0/\u003e`_.\n\n|pypi| |build-status| |coveralls|\n\nInstallation\n============\n\nUse pip::\n\n  pip install git-blackhole\n\nDirectly download from GitHub::\n\n  curl https://raw.githubusercontent.com/tkf/git-blackhole/master/git_blackhole.py --output git-blackhole\n  chmod u+x git-blackhole\n\n\nSynopsis\n========\n\n.. code:: shell\n\n  git blackhole init [--name \u003crepo\u003e] \u003curl\u003e\n  git blackhole push [--remote \u003crepo\u003e]\n  git blackhole warp [--remote \u003crepo\u003e]\n  git blackhole trash-branch [--remote \u003crepo\u003e] \u003cbranch\u003e\n  git blackhole trash-stash [--remote \u003crepo\u003e] \u003cstash_range\u003e\n  git blackhole fetch-trash [--remote \u003crepo\u003e]\n  git blackhole ls-trash\n  git blackhole show-trash\n  git blackhole rm-local-trash (--all | \u003cref\u003e...)\n  git blackhole [\u003csubcommand\u003e] (-h|--help)\n\nDescription\n===========\n\nThe aim of ``git-blackhole`` is to connect any of your repositories to\na single repository (\"blackhole\" repository) to which you can push any\ncommits --- WIP commits, branches no longer needed, and useless\nstashes.\n\nThere are three main features of ``git-blackhole``:\n\n1. **Continuous backup**.  You can use ``git-blackhole`` to\n   continuously backup commits in background to a remote repository\n   (or actually any repository) called *blackhole repository*.\n\n   Run ``git blackhole init \u003curl\u003e`` and then setup ``post-commit``\n   hook to run ``git blackhole push``.  See the help of ``git\n   blackhole init`` and ``git blackhole push`` for the details.\n\n   Note that blackhole repository at ``\u003curl\u003e`` can be used for\n   arbitrary number of local repositories.  You just need to setup a\n   single repository once.\n\n   By combining with git-wip_ command, you can backup/share\n   uncommitted changes as well.\n\n2. **Sharing local repository state**.  Since ``git-blackhole`` can\n   push commits and the location of HEAD to the blackhole repository,\n   the state of a repository in one machine is accessible from other\n   machines.\n\n   For example, if you forget to push a commit from your desktop (to\n   the usual remote) but want to resume the work from your laptop,\n   ``git blackhole warp`` would be helpful.\n\n3. **Recoverable trash can**.  Use ``git blackhole trash-branch`` and\n   ``git blackhole trash-stashes`` to remove branches and stashes from\n   the local repository after sending them to the remote blackhole\n   repository.  They are stored remotely as ordinary branches so that\n   you can recover them easily.\n\n.. _git-wip: https://github.com/bartman/git-wip\n\n``git blackhole init``\n    Add blackhole remote at `url` with `name`.\n\n    This command runs ``git remote add \u003cname\u003e \u003curl\u003e`` and configure\n    appropriate `remote.\u003cname\u003e.fetch` and `remote.\u003cname\u003e.pushe`\n    properties so that remote blackhole repository at `url` acts\n    as if it is a yet another remote repository.\n\n    To be more precise, each local branch is related to the branch at\n    the blackhole remote with the prefix ``heads/$HOST/$REPOKEY/``\n    where ``$HOST`` is the name of local machine and ``$REPOKEY`` is\n    the path of the repository relative to ``$HOME``.\n\n\n\n\n``git blackhole warp``\n    Peek into other repositories through the blackhole.\n\n\n\n``git blackhole push``\n    Push branches and HEAD forcefully to blackhole `remote`.\n\n    Note that local HEAD is pushed to the remote branch named\n    ``heads/$HOST/$REPOKEY/HEAD`` (see help of ``git blackhole init``)\n    instead of real remote HEAD.  This way, if the blackhole remote is\n    shared with other machine, you can recover the HEAD at ``$HOST``.\n\n    It is useful to call this command from the ``post-commit`` hook::\n\n      nohup git blackhole push --no-verify \u0026\u003e /dev/null \u0026\n\n    See also `githooks(5)`.\n\n    To push revisions created by git-wip_ command, add option\n    ``--ref-glob='refs/wip/*'``.\n\n\n\n\n``git blackhole trash-branch``\n    [EXPERIMENTAL] Save `branch` in blackhole `remote` before deletion.\n\n    The `branch` is pushed to the branch of the blackhole `remote`\n    named ``trash/$HOST/$REPOKEY/$SHA1[:2]/$SHA1[2:]`` where ``$HOST``\n    is the name of local machine, ``$REPOKEY`` is the path of the\n    repository relative to ``$HOME``, and ``$SHA1`` is the revision of\n    the commit.  (To be more precise, ``$SHA`` is the revision of the\n    commit recording the revision of `branch` and some meta\n    information).\n\n    Use ``git blackhole fetch-trash`` to retrieve all trashes from\n    remote and store them locally.  Commands ``git blackhole\n    ls-branch`` and ``git blackhole show-branch`` can be used to list\n    and show trash commits.\n\n    .. WARNING:: Commands to navigate through trashes (e.g., ``git\n       blackhole show-branch``) are still preliminary.  Furthermore,\n       how trash metadata is stored may change in the future.\n       However, since trashes are ordinary git branches in remote,\n       they can be dealt with standard git commands.\n\n\n\n\n``git blackhole trash-stash``\n    [EXPERIMENTAL] Save stashes in blackhole `remote` before deletion.\n\n    It works as (almost) the same way as ``git blackhole trash-branch``.\n\n    Several stashes can be specified in `stash_range`.  It takes\n    single numbers (e.g., 3) and ranges (e.g., 3-5 or 8-) separated by\n    commas.  Each range is in the form ``x-y`` which selects stashes\n    ``x, x+1, x+2, ..., y``.  The upper limit ``y`` can be omitted,\n    meaning \"until the last stash\".  For example, when you have\n    stashes 0 to 10, ``git blackhole trash-stash 0,3-5,8-`` removes\n    stashes 0, 3, 4, 5, 8, 9, and 10.\n\n\n\n\n``git blackhole fetch-trash``\n    Fetch trashes from remote to ``refs/bh/trash/``.\n\n\n\n``git blackhole ls-trash``\n    List trashes fetched by ``git blackhole fetch-trash``.\n\n\n\n``git blackhole show-trash``\n    Run ``git show`` on trashes fetched by ``git blackhole fetch-trash``.\n\n\n\n``git blackhole rm-local-trash``\n    Remove trashes fetched by ``git blackhole fetch-trash``.\n\n\n\nOptions\n=======\n\n``git blackhole init``\n------------------------------------------------------------------\n\n--verbose, -v         print git commands to run (default: False)\n\n--dry-run, -n         do nothing when given. Use it with --verbose to see\n                      what is going to happen. (default: False)\n\n--name NAME           name of the remote blackhole repository (default:\n                      blackhole)\n\n--mangle [{never,always,auto}]\n                      Replace a dot right after the path separator (hidden\n                      directories) to underscore \"_\" and use it as REPOKEY.\n                      --mangle[=auto] means to do it only when necessary.\n                      --mangle=always means to always set REPOKEY.\n                      --mangle=never means no replacement and fail with an\n                      error for hidden directories. (default: never)\n\n--repokey REPOKEY     Set arbitrary REPOKEY for the location of this\n                      repository in the blackhole repository. (default:\n                      None)\n\n\n``git blackhole warp``\n------------------------------------------------------------------\n\n--verbose, -v      print git commands to run (default: False)\n\n--dry-run, -n      do nothing when given. Use it with --verbose to see what\n                   is going to happen. (default: False)\n\n--name NAME        Name of the repository at \u003cHOST\u003e:\u003cREPOKEY\u003e, accessed\n                   through the blackhole. Set to \"bh_\u003cHOST\u003e\" if empty.\n                   (default: )\n\n--url URL          URL of the remote blackhole repository Use\n                   remote.\u003cREMOTE\u003e.url if not given. (default: None)\n\n--remote REMOTE    name of the remote blackhole repository (default:\n                   blackhole)\n\n--repokey REPOKEY  The repository relative to the $HOME at \u003cHOST\u003e. Use\n                   current repository root if empty. (default: None)\n\n\n``git blackhole push``\n------------------------------------------------------------------\n\n--verbose, -v         print git commands to run (default: False)\n\n--dry-run, -n         do nothing when given. Use it with --verbose to see\n                      what is going to happen. (default: False)\n\n--verify              passed to git-push (default: None)\n\n--no-verify           passed to git-push (default: True)\n\n--remote REMOTE       name of the remote blackhole repository (default:\n                      blackhole)\n\n--ref-glob REF_GLOBS  add glob patterns to be pushed, e.g., wip/* (default:\n                      [])\n\n--ignore-error        quick with code 0 on error (default: False)\n\n--skip-if-no-blackhole\n                      do nothing if git blackhole is not configured\n                      (default: False)\n\n\n``git blackhole trash-branch``\n------------------------------------------------------------------\n\n--verbose, -v         print git commands to run (default: False)\n\n--dry-run, -n         do nothing when given. Use it with --verbose to see\n                      what is going to happen. (default: False)\n\n--verify              passed to git-push (default: None)\n\n--no-verify           passed to git-push (default: True)\n\n--remote REMOTE       name of the remote blackhole repository (default:\n                      blackhole)\n\n--remove-upstream, -u\n                      remove branch in upstream repository. i.e., remove\n                      branch.\u003cbranch\u003e.merge at branch.\u003cbranch\u003e.remote.\n                      ignored if no remote is set. (default: False)\n\n\n``git blackhole trash-stash``\n------------------------------------------------------------------\n\n--verbose, -v       print git commands to run (default: False)\n\n--dry-run, -n       do nothing when given. Use it with --verbose to see what\n                    is going to happen. (default: False)\n\n--verify            passed to git-push (default: None)\n\n--no-verify         passed to git-push (default: True)\n\n--remote REMOTE     name of the remote blackhole repository (default:\n                    blackhole)\n\n--keep-stashes, -k  when this option is given, do not remove local stashes.\n                    (default: False)\n\n\n``git blackhole fetch-trash``\n------------------------------------------------------------------\n\n--verbose, -v    print git commands to run (default: False)\n\n--dry-run, -n    do nothing when given. Use it with --verbose to see what is\n                 going to happen. (default: False)\n\n--remote REMOTE  name of the remote blackhole repository (default:\n                 blackhole)\n\n\n``git blackhole ls-trash``\n------------------------------------------------------------------\n\n--verbose, -v  print git commands to run (default: False)\n\n--dry-run, -n  do nothing when given. Use it with --verbose to see what is\n               going to happen. (default: False)\n\n\n``git blackhole show-trash``\n------------------------------------------------------------------\n\n--verbose, -v  print git commands to run (default: False)\n\n--dry-run, -n  do nothing when given. Use it with --verbose to see what is\n               going to happen. (default: False)\n\n\n``git blackhole rm-local-trash``\n------------------------------------------------------------------\n\n--verbose, -v  print git commands to run (default: False)\n\n--dry-run, -n  do nothing when given. Use it with --verbose to see what is\n               going to happen. (default: False)\n\n--all, -a      remove all local copy of trashes (default: False)\n\n\n.. |logo|\n   image:: logo/horizontal.png\n   :align: middle\n   :target: logo/\n   :alt: Logo by @reallinfo https://github.com/reallinfo. This work is licensed under a Creative Commons Attribution 4.0 International License. (https://creativecommons.org/licenses/by/4.0/)\n\n.. |pypi|\n   image:: https://badge.fury.io/py/git-blackhole.svg\n   :target: https://badge.fury.io/py/git-blackhole\n   :alt: Python Package Index\n\n.. |build-status|\n   image:: https://travis-ci.org/tkf/git-blackhole.svg?branch=master\n   :target: https://travis-ci.org/tkf/git-blackhole\n   :alt: Build Status\n\n.. |coveralls|\n   image:: https://coveralls.io/repos/github/tkf/git-blackhole/badge.svg?branch=master\n   :target: https://coveralls.io/github/tkf/git-blackhole?branch=master\n   :alt: Test Coverage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkf%2Fgit-blackhole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkf%2Fgit-blackhole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkf%2Fgit-blackhole/lists"}