Aller au contenu

dotbare

https://github.com/kazhala/dotbare

Installation

Dépendances

brew install fzf tree bat (ou highlight, coderay) delta (ou diff-so-fancy)

zsh:

# zinit

zinit light kazhala/dotbare

# antibody

antibody bundle kazhala/dotbare

ou

$ git clone https://github.com/kazhala/dotbare.git ~/.dotbare

puis source ~/.dotbare/dotbare.plugin.zsh dans les fichiers .zshrc

bash:

$ git clone https://github.com/kazhala/dotbare.git ~/.dotbare

puis source ~/.dotbare/dotbare.plugin.bash dans les fichiers .bashrc ou .bash_profile

Initialisation:

# init dépôt git bare (dans $HOME/.cfg).

$ dotbare finit

Utilisation:

Ajouter les fichiers à suivre:

# Fichiers

$ dotbare fadd -f
# ou
$ dotbare add [FIELNAME]

# Répertoires

$ dotbare fadd -d
# ou
$ dotbare add [DIRECTORY]

Commit changes and push to remote:

$ dotbare commit -m "First commit"
$ dotbare remote add origin [URL]
$ dotbare push -u origin master

Alias:

alias dbpush='dotbare push -u mbv master'
alias dbadd='dotbare add -f $1'
alias dbcomm='dotbare commit -am $1'
alias dbback='dotbare fbackup'

Préférences:

# Default value
export DOTBARE_DIR="$HOME/.cfg"

export DOTBARE_TREE="$HOME"

export DOTBARE_BACKUP="${XDG_DATA_HOME:-$HOME/.local/share}/dotbare"

export DOTBARE_KEY="
  --bind=alt-a:toggle-all       # toggle all selection
  --bind=alt-j:jump             # label jump mode, sort of like vim-easymotion
  --bind=alt-0:top              # set cursor back to top
  --bind=alt-s:toggle-sort      # toggle sorting
  --bind=alt-t:toggle-preview   # toggle preview
"

export DOTBARE_FZF_DEFAULT_OPTS="--preview-window=right:65%"

export DOTBARE_PREVIEW="cat -n {}"

export DOTBARE_DIFF_PAGER="delta --diff-so-fancy --line-numbers"

fbackup:

D'après la variable DOTBARE_BACKUP

  • Backup files to /Users/bruno/.local/share/dotbare.
  • This is useful when untracking files or migrating to new machines.
  • Default: backup all tracked files using cp command to /Users/bruno/.local/share/dotbare directory.
# -$HOME/.local/share/dotbare

#Sauvegarger tous les fichiers:

$ dotbare fbackup

# Pour choisir les fichiers à backuper:

$ dotbare fbackup -s

# -s, --select                  list all tracked files and only backup the selected files.
# -p PATH, --path PATH  specify path of files to backup.
# -m, --move                        use 'mv' instead of the default 'cp' command to backup.

fedit:

  • Select files/commits through fzf and edit selected files/commits in EDITOR.
  • Default: list all tracked dotfiles and edit the selected files.
$ dotbare fedit

#  -h, --help           show this help message and exit.
#  -m                       uniquement les fichiers modifiés
#  -c                       affiche les commits

fgrep:

  • Grep words within tracked files and select to edit matches.
$ dotbare fgrep

#  -h, --help                   show this help message and exit.
#  -c COL, --col COL    specify the column number to start searching.
#  -f, --full                   include all column during search, as if using '--col 1'.

flog:

  • Interactive log viewer with action menu.
  • Action menu contains options including revert|reset|edit|checkout|exit.
  • Default: list all commits and prompt a menu to select action to perform.
$ dotbare flog

#  -h, --help           show this help message and exit.
#  -r, --revert     revert the selected commit and skip action menu.
#  -R, --reset      reset HEAD back to selected commit and skip action menu.
#  -e, --edit           edit selected commit through interactive rebase and skip action menu.
#  -c, --checkout   checkout selected commit and skip action menu.
#  -y, --yes            acknowledge all actions that will be taken and skip confirmation.

freset:

  • Reset(unstage) the selected staged files. (Default)
  • Reset the HEAD to certain commits by using -c flag.
$ dotbare freset

#  -h, --help           show this help message and exit.
#  -c, --commit     reset HEAD to certain commit, default --mixed flag, reset HEAD to certain commit put all changes into modified state.
#  -S, --soft       reset commit using --soft flag, reset HEAD to certain commit without modify working tree.
#  -H, --hard       reset commit using --hard flag, reset HEAD to certain commit discard all changes from the working tree.
#  -y, --yes        acknowledge all actions that will be taken and skip confirmation.

fcheckout:

  • Select files/commit/branch through fzf and checkout the selected objects.
  • Files: checkout the version in HEAD or in a specific commit (reset files content back to the selected commit).
  • Branch: switch to the selected branch.
  • Commit: switch to a specific commit.
  • Default: list all modified files and reset selected files back to HEAD.
$ dotbare fcheckout

#  -h, --help           show this help message and exit.
#  -s, --select     list all tracked files and select a commit to checkout the selected files.
#  -b, --branch     list all branch and checkout/switch the selected branch.
#  -c, --commit     list all commits and checkout selected commit.
#  -y, --yes        acknowledge all actions that will be taken and skip confirmation.

fstash

  • View and manage stash interactively
$ dotbare fstash

# Default: list all stashes and apply the selected stash files

#  -h, --help           show this help message and exit.
#. -s, --select     list modified files and stash the selected files
#  -d, --delete     list all stashes and delete the selected stash files
#  -p, --pop            use 'stash pop' instead of 'stash apply'

fstat

  • Display interactive git status menu
  • Toggle file stage/unstage interactively
$ dotbare fstat

#  -h, --help       show this help message and exit.

funtrack

  • Untrack selected files from git
$ dotbare funtrack

# Default: list all tracked files and permanently untrack the selected files  (using git rm --cached filename).
# Files will be remove from index while keeping the file in your current system.
# However, when your other computers pull down the changes, the untracked files will be deleted.
# Make sure to run dotbare fbackup before pulling down the changes.

# Alternatively use the -t flag (using git update-index --assume-unchanged [path]) to temporarily untrack a file but keeping the files when other computers pull down the changes.


#  -h, --help       show this help message and exit.
#  -t, --temp       list all trackes files and temporarily ignore changes of the selected files.
#  -r, --resume list all trackes files and resume tracking changes of the selected files.
#  -y, --yes        acknowledge all actions that will be taken and skip confirmation.

fupgrade

  • Upgrade dotbare to the latest master
$ dotbare fupgrade

#  -h, --help       show this help message and exit.

Liste des fichiers sauvegardés:

~/.local/share/dotbare                                                         08:42:08
❯ l
Permissions  Size User  Group Date Modified Date Created Name
.rwxr-xr-x  1,1Ki bruno staff 25 jul  2021  25 jul  2021  .backup_list.conf*
.rwxr-xr-x  2,5Ki bruno staff 25 jul  2021  25 jul  2021  .bash_aliases*
.rwxr-xr-x  7,8Ki bruno staff  4 fév 20:07  25 jul  2021  .bash_profile*
.rw-r--r--    259 bruno staff  4 fév 20:07  24 jul  2021  .bashrc
drwxr-xr-x      - bruno staff 12 aoû  2021  12 aoû  2021  .config/
.rw-r--r--    236 bruno staff 21 nov  2021   1 aoû  2021  .diractions
.rwxr-xr-x   21Ki bruno staff 25 jul  2021  25 jul  2021  .dircolors*
.rwxr-xr-x     10 bruno staff 25 jul  2021  25 jul  2021  .exclude-rsync.txt*
.rw-r--r--    318 bruno staff 16 fév 15:02   4 aoû  2021  .gitconfig
.rwxr-xr-x    134 bruno staff 12 aoû  2021  25 jul  2021  .gitignore*
.rw-r--r--    645 bruno staff  7 aoû  2021   7 aoû  2021  .my.cnf.gpg
drwxr-xr-x      - bruno staff  5 mai 08:33  12 aoû  2021  .nano/
.rw-r--r--  2,7Ki bruno staff 25 jul  2021  25 jul  2021  .nanorc
.rw-r--r--@ 9,7Ki bruno staff  1 aoû  2021   1 aoû  2021  .p10k.zsh
drwxr-xr-x      - bruno staff 12 aoû  2021  12 aoû  2021  .ssh/
.rwxr-xr-x     69 bruno staff 25 jul  2021  25 jul  2021  .ticker.conf*
.rwxr-xr-x    355 bruno staff 25 jul  2021  25 jul  2021  .ticker.yaml*
.rw-r--r--    130 bruno staff 17 aoû  2021  23 jul  2021  .zprofile
.rwxr-xr-x@   349 bruno staff 31 jul  2021  31 jul  2021  .zsh_plugins.txt*
.rw-r--r--     28 bruno staff  1 aoû  2021   1 aoû  2021  .zshbookmarks
.rw-r--r--@  25Ki bruno staff  4 mai 08:06  12 aoû  2021  .zshrc
.rw-r--r--@  16Ki bruno staff 31 jul  2021  31 jul  2021  .zshrc-antibody.bak

Dernière mise à jour: September 15, 2021