📝 Start fish-git cheatsheet

This commit is contained in:
punkfairie 2024-02-06 21:40:29 -08:00
parent 8cbd7ca94e
commit a936622dbe
No known key found for this signature in database
GPG key ID: 0858B0F48128A755
2 changed files with 68 additions and 11 deletions

65
cheat/sheets/fish-git Normal file
View file

@ -0,0 +1,65 @@
---
syntax: fish
---
# Staging:
ga: 'git add'
gaa: 'git add --all'
gapa: 'git add --patch'
gd: 'git diff'
gds: 'git diff --staged'
gdw: 'git diff --word-diff'
gdsw: 'git diff --staged --word-diff'
gst: 'git status --short --branch'
gstl: 'git status'
# Committing:
gc: 'git commit'
gc!: 'git commit --amend'
gcn!: 'git commit --amend --no-edit'
gca 'git add --all && git commit'
gca!: 'git add --all && git commit --amend'
gcan!: 'git add --all && git commit --amend --no-edit'
gcfu: 'git commit --fixup'
grev: 'git revert'
# Working dir & index manipulation:
gco: 'git checkout'
grt: 'git reset'
# grt <commit> -- [<path>]: undo <commit> but keep changes in working dir.
grts: 'git reset --soft'
# undo commits and stage their changes.
grs: 'git restore --worktree'
# grs <unstaged-path> - revert local changes for <unstaged-path>.
# (--worktree is the default behavior, but included here for clarity).
grss: 'git restore --worktree --source'
# grss <commit> <unstaged-path> - revert <unstaged-path> to <commit>"s version.
grst: 'git restore --staged'
# grst <staged-path> - unstage <staged-path>
grsts: 'git restore --staged --source'
# See grss, but for <staged-path>s.
grsa: 'git restore --staged --worktree'
# grsa <path> - discard all changes for <path>, both staged and unstaged.
grsas: 'git restore --staged --worktree --source'
grm: 'git rm'
# Remove paths from index & working dir.
grmc: 'git rm --cached'
# Unstage & remove only from index; leave in working dir.
# grmc <path> - where <path> is already tracked: stages the removal of <path>

View file

@ -93,22 +93,14 @@ abbr -a gc --position command "git commit"
abbr -a "gc!" --position command "git commit --amend"
abbr -a "gcn!" --position command "git commit --no-edit --amend"
abbr -a gca --position command "git add --all && git commit"
abbr -a "gca!" --position command "git commit -a --amend"
abbr -a "gcan!" --position command "git commit -a --no-edit --amend"
abbr -a gcam --position command "git commit -a -m"
abbr -a "gca!" --position command "git add --all && git commit --amend"
abbr -a "gcan!" --position command "git add --all && git commit --no-edit --amend"
abbr -a gcam --position command "git add --all && git commit -m"
abbr -a gcmsg --position command "git commit -m"
abbr -a gcfu --position command "git commit --fixup"
abbr -a grev --position command "git revert"
# Update the last commit with all staged changes.
abbr -a gu --position command "git commit --amend"
abbr -a "gu!" --position command "git commit --amend --no-edit"
# Update the last commit with all local changes.
abbr -a gua --position command "git add --all && git commit --amend"
abbr -a "gua!" --position command "git add --all && git commit --amend --no-edit"
################################################################################
# Working Dir & Index Manipulation #
################################################################################