| Author: | jan+git-branch-backup@matejka.ninja |
|---|---|
| Date: | 2022-08-15 |
| Copyright: | Copyright (c) 2022, Jan Matějka (jan+git-branch-backup@matejka.ninja) |
| 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 zshbuiltinsandman 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$sconstructing backups likemaster.backup/2formasterbranch. 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$sconstructing backups likedev/master/2formaster.
- Creating backup branches
Assuming you are standing on
masterbranch 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 gitman 1 git-branchman 1 git-rebaseman 1 git-reflog- https://www.matejka.ninja/software/handbook/git.html