-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.cheat
36 lines (24 loc) · 776 Bytes
/
git.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
% git, common
# Select commit from log
$ commit-fzf: git flog --all \
| fzf --ansi --bind 'ctrl-p:toggle-preview' --preview-window=':hidden' \
--preview "echo {} | grep -oEi '[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?' | xargs -r git show" \
| grep -oEi '[0-9a-f]{7,8}' \
| head -1
$ branch-fzf: git branch | fzf
% git
@ git, common
# Interactive rebase
git rebase -i <commit-fzf>
# Interactive fixup
git commit --fixup=<commit-fzf>
# Interactive revert
git revert <commit-fzf>
# Switch branch
git switch <branch-fzf>
# See logs - including deleted
git log --all --full-history -- <read>
% git, gitignore
# Populate gitignore file from from GitHub template
gibo dump <gibo-list-fzf> > .gitignore
$ gibo-list-fzf: gibo list | fzf