Author: | [email protected] |
---|---|
Date: | 2022-08-15 |
Copyright: | Copyright (c) 2022, Jan Matějka ([email protected]) |
Manual Section: | 1 |
Manual Group: | git-branch-backup |
Homepage: | https://github.com/yaccz/git-branch-backup |
git branch-backup
git-branch-backup creates a local backup branch of the branch checked out in PWD by creating another branch named according to the BACKUP_BRANCH_FMT environment variable.
It can be useful to create a branch backup e.g. before using man 1 git-rebase
in case something
goes wrong so you do not have to go reflog diving (man 1 git-reflog
).
None.
- BACKUP_BRANCH_FMT
Format string used to construct backup branch name via zsh builtin printf ( see
man 1 zshbuiltins
andman 3 printf
).1st argument is current branch name.
2nd argument is the new backup branch id. Backup branch ids are decimal numbers starting from 1.
Defaults to
%1$s.backup/%2$s
constructing backups likemaster.backup/2
formaster
branch. Note including the/
in the backup branch name is motivated by existence of IDEs and other UIs that display branch names as collapsible tree.Example alternative:
dev/%1$s/%2$s
constructing backups likedev/master/2
formaster
.
- Creating backup branches
Assuming you are standing on
master
branch in PWD:$ git branch-backup Created backup branch 'master.backup/1' $ git branch-backup Created backup branch 'master.backup/2'
- Deleting backup branches
$ git branch -d master.backup/{1..666}
- Alias for convenience
$ git config --global alias.bb branch-backup
- 0
- Success
- >0
- Error
$ make build
- gnu make
- docutils
- posix.1-2017 utilities
- gnu coreutils
- install
Into system:
# make install
Into user's HOME:
$ make install-home
- zsh
- git
- GNU sed
- GNU grep
- GNU coreutils
- head
- sort
$ make check
BSD-3. See ./LICENSE file.
man 1 git
man 1 git-branch
man 1 git-rebase
man 1 git-reflog
- https://www.matejka.ninja/software/handbook/git.html