This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# Adding files | |
## "add untracked" - no untracked files | |
au = add -u | |
## "add all" - add everything. https://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add | |
aa = add -A | |
## "add patch" - choose what to add | |
ap = add -p | |
# Checkouts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add all files except untracked | |
$ git au | |
# add all files | |
$ git aa | |
# you can use it to add all the contents of a specific directory | |
$ git aa <dirname> | |
# add patch | |
$ git ap <filename> | |
# checkout & create a new branch | |
$ git cob <new-branch-name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# commits | |
## show me my diff while writing the commit message | |
ct = commit --verbose | |
## "commit add" add all files then commit | |
cta = commit -a --verbose | |
## amend is slightly long but it felt natural this way | |
amend = commit --verbose --amend | |
## you can combine actions like this: | |
## "add amend" - first add, then amend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# checkouts | |
## "checkout regex" - more or less checkout branches by regex | |
cor = "!checkout_by_regex() { git checkout $(git branch | grep -e \"$1\" | head -n1); }; checkout_by_regex" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# more aliases here | |
## "checkout fzf" checkout with fzf | |
cof = "!checkout_fzf() { git branch | fzf | xargs git checkout; }; checkout_fzf" | |
## "add fzf" add multiple files with fzf | |
aaf = "!add_fzf() { git status -s | awk '{print $2}' | fzf -m | xargs git add; }; add_fzf" | |
## "add files and commit" add files with fzf and then immediately commit | |
afc = "!add_files_and_commit() { git status -s | awk '{print $2}' | fzf -m | xargs git add && git commit --verbose; }; add_files_and_commit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# imagine you're on master | |
# and you want to checkout to branch some-very-long-branch-name | |
$ g cor long | |
# using a unique part of the branch name makes it much easier to checkout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
# Adding files | |
## "add untracked" - no untracked files | |
au = add -u | |
## "add all" - add everything. https://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add | |
aa = add -A | |
## "add patch" - choose what to add | |
ap = add -p | |
## "add fzf" add multiple files with fzf | |
aaf = "!add_fzf() { git status -s | awk '{print $2}' | fzf -m | xargs git add; }; add_fzf" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Add preview to files search | |
command! -bang GFiles call fzf#vim#gitfiles('', fzf#vim#with_preview('right')) | |
command! -bang Files call fzf#vim#files('', fzf#vim#with_preview('right')) | |
" Just use :GFiles & :Files regularly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, '--color-path "1;36"', fzf#vim#with_preview(), <bang>0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Navigate to branches using FZF | |
cof = "!checkout_fzf() { git branch | fzf | xargs git checkout; }; checkout_fzf" | |
# Add files using FZF | |
af = "!add_fzf() { git status -s | awk '{print $2}' | fzf -m | xargs git add; }; add_fzf" | |
# Add files using FZF and immediately commit them | |
afmend = "!add_fzf_amend() { git status -s | awk '{print $2}' | fzf -m | xargs git add && git amend; }; add_fzf_amend" | |
# Restore files (like removing multiple files from the staging area) | |
ref = "!restore_fzf() { git status -s | awk '{print $2}' | fzf -m | xargs git restore; }; restore_fzf" | |
# Delete untracked files using FZF | |
rmf = "!delete_untracked() { git ls-files --exclude-standard --other | fzf -m | xargs rm; }; delete_untracked" |
OlderNewer