|
1 | 1 | {
|
2 |
| - "amend": "git diff-index --cached --quiet HEAD || git commit --amend -C HEAD", |
3 |
| - "beta": "git release-beta", |
4 |
| - "cleanup": "git stash save --include-untracked --keep-index; git clean --force -d -x -e \".env*\"; git stash apply --index; git stash drop", |
5 |
| - "co": "git commit -m \"$1\"", |
6 |
| - "conflict": "git diff --name-only --diff-filter=U", |
7 |
| - "continue": "git checkout -- . && git rebase --continue", |
8 |
| - "crush": "git stash save --keep-index --include-untracked && git reset --hard $(git rev-parse --abbrev-ref --symbolic-full-name @{u})", |
9 |
| - "editLast": "git commit --amend --edit", |
10 |
| - "fixable": "git log --oneline $(git rev-parse --abbrev-ref --symbolic-full-name @{u})..HEAD", |
11 |
| - "fixAuthor": "git config \"${1---global}\" user.name \"$(git log -2 --pretty=format:'%an' | tail -1)\" && git config \"${1---global}\" user.email \"$(git log -2 --pretty=format:'%ae' | tail -1)\"", |
12 |
| - "fixConfig": "git config --global --get-regexp '^alias.' | grep '/tmp' | cut -d ' ' -f1 | while read -r alias; do git config --global --unset \"$alias\"; done", |
13 |
| - "fixMode": "git diff -p -R --no-color | grep -E \"^(diff|(old|new) mode)\" --color=never | git apply --allow-empty --no-index", |
14 |
| - "forceable": "git log --oneline $(echo $(git rev-parse --abbrev-ref --symbolic-full-name @{u};git log --merges --first-parent -1 --pretty=%h)| tail -1)..HEAD $*", |
15 |
| - "go": "git commit -m \"$1\" --all", |
16 |
| - "hfix": "git release-hotfix", |
17 |
| - "histo": "git log --oneline $(git log --merges --first-parent -1 --pretty=%h) $*", |
18 |
| - "ignore": "grep -qxF \"$1\" .gitignore || echo \"$1\" >>.gitignore && git rm --cached \"$1\" 2>/dev/null", |
19 |
| - "initFrom": "git clone --origin template --branch master --depth 1 -- $1 $2 && cd $2 && git branch -m master template && git checkout -b master && git checkout -b develop", |
20 |
| - "isChanged": "git diff --name-only HEAD@{1} HEAD | grep -q \"^$1\" && exit 0 || exit 1", |
21 |
| - "isDirty": "git diff --name-only | grep -q \"^$1\" && exit 0 || exit 1", |
22 |
| - "isFixup": "git log -1 --pretty=%s | grep -q fixup! && exit 0 || exit 1", |
23 |
| - "isRebase": "git rev-parse --git-dir | grep -q rebase-merge || git rev-parse --git-dir | grep -q rebase-apply", |
24 |
| - "pf": "git push --force-with-lease", |
25 |
| - "prod": "git release-prod", |
26 |
| - "rAbort": "git rebase --abort", |
27 |
| - "rCont": "git rebase --continue", |
28 |
| - "renameTag": "set -e;git tag $2 $1; git tag -d $1;git push origin :refs/tags/$1;git push --tags", |
29 |
| - "stack": "git commit --amend --no-edit --no-verify -C HEAD", |
30 |
| - "sync": "git fetch --progress --prune --recurse-submodules=no origin && git stash save --keep-index --include-untracked && git merge --ff-only @{u} && git stash pop --index || git stash drop", |
31 |
| - "undo": "git reset --soft HEAD^ --" |
| 2 | + "abort": { |
| 3 | + "cmd": "git rebase --abort", |
| 4 | + "help": "Abort an ongoing rebase." |
| 5 | + }, |
| 6 | + "alias": { |
| 7 | + "cmd": "git config --system alias.$1 \"!sh -c 'set -e; git hint \"$2\" \\$1; $3' -- \\$@\"", |
| 8 | + "help": "Create a new alias for a git command. Usage: git alias <alias> <help> <command>" |
| 9 | + }, |
| 10 | + "amend": { |
| 11 | + "cmd": "git diff-index --cached --quiet HEAD || git commit --amend --reset-author -C HEAD", |
| 12 | + "help": "Amend the last commit if there are staged changes." |
| 13 | + }, |
| 14 | + "cleanup": { |
| 15 | + "cmd": "git stash save --include-untracked --keep-index; git clean --force -d -x -e \".env*\"; git stash apply --index; git stash drop", |
| 16 | + "help": "Stash all changes, clean untracked files except .env*, and restore stash." |
| 17 | + }, |
| 18 | + "co": { |
| 19 | + "cmd": "git commit -m \"$1\"", |
| 20 | + "help": "Commit with a message." |
| 21 | + }, |
| 22 | + "conflict": { |
| 23 | + "cmd": "git diff --name-only --diff-filter=U", |
| 24 | + "help": "List files with merge conflicts." |
| 25 | + }, |
| 26 | + "continue": { |
| 27 | + "cmd": "git checkout -- . && git rebase --continue", |
| 28 | + "help": "Restore all files and continue a rebase." |
| 29 | + }, |
| 30 | + "editLast": { |
| 31 | + "cmd": "git commit --amend --edit", |
| 32 | + "help": "Edit the last commit message and content." |
| 33 | + }, |
| 34 | + "fixable": { |
| 35 | + "cmd": "git log --oneline $(git rev-parse --abbrev-ref --symbolic-full-name @{u})..HEAD", |
| 36 | + "help": "Show commits ahead of upstream." |
| 37 | + }, |
| 38 | + "fixAuthor": { |
| 39 | + "cmd": "git config \"${1---global}\" user.name \"$(git log -2 --pretty=format:'%an' | tail -1)\" && git config \"${1---global}\" user.email \"$(git log -2 --pretty=format:'%ae' | tail -1)\"", |
| 40 | + "help": "Set user.name and user.email to previous commit's author." |
| 41 | + }, |
| 42 | + "fixConfig": { |
| 43 | + "cmd": "rm -f ~/.gitconfig", |
| 44 | + "help": "Remove the global git config file." |
| 45 | + }, |
| 46 | + "fixMode": { |
| 47 | + "cmd": "git diff -p -R --no-color | grep -E \"^(diff|(old|new) mode)\" --color=never | git apply --allow-empty --no-index", |
| 48 | + "help": "Restore file mode changes from diff." |
| 49 | + }, |
| 50 | + "forceable": { |
| 51 | + "cmd": "git log --oneline $(echo $(git rev-parse --abbrev-ref --symbolic-full-name @{u};git log --merges --first-parent -1 --pretty=%h)| tail -1)..HEAD $*", |
| 52 | + "help": "Show commits since last merge or upstream." |
| 53 | + }, |
| 54 | + "fwb": { |
| 55 | + "cmd": "git release-beta", |
| 56 | + "help": "Run release-beta command." |
| 57 | + }, |
| 58 | + "fwf": { |
| 59 | + "cmd": "git flow start feature $1", |
| 60 | + "help": "Start a new git flow feature branch." |
| 61 | + }, |
| 62 | + "fwh": { |
| 63 | + "cmd": "git release-hotfix", |
| 64 | + "help": "Run release-hotfix command." |
| 65 | + }, |
| 66 | + "fwp": { |
| 67 | + "cmd": "git release-prod", |
| 68 | + "help": "Run release-prod command." |
| 69 | + }, |
| 70 | + "fwt": { |
| 71 | + "cmd": "git tag -a $1 -m \"$1\" && git push origin $1", |
| 72 | + "help": "Create and push an annotated tag." |
| 73 | + }, |
| 74 | + "go": { |
| 75 | + "cmd": "git commit -m \"$1\" --all", |
| 76 | + "help": "Commit all changes with a message." |
| 77 | + }, |
| 78 | + "hint": { |
| 79 | + "cmd": "if \"$2\" = \"-h\"; then echo \"Usage: $2\"; git config --get-regexp \"^alias\\.\" | awk \\'{printf \"%-20s\",$1 }\\'", |
| 80 | + "help": "Display help hint for aliases. Usage: git hint <help message> [<args>]" |
| 81 | + }, |
| 82 | + "histo": { |
| 83 | + "cmd": "git log --oneline $(git log --merges --first-parent -1 --pretty=%h) $*", |
| 84 | + "help": "Show log since last merge." |
| 85 | + }, |
| 86 | + "ignore": { |
| 87 | + "cmd": "grep -qxF \"$1\" .gitignore || echo \"$1\" >>.gitignore && git rm --cached \"$1\" 2>/dev/null", |
| 88 | + "help": "Add file to .gitignore and untrack it." |
| 89 | + }, |
| 90 | + "initFrom": { |
| 91 | + "cmd": "git clone --origin template --branch master --depth 1 -- $1 $2 && cd $2 && git branch -m master template && git checkout -b master && git checkout -b develop", |
| 92 | + "help": "Clone as template, create master and develop branches." |
| 93 | + }, |
| 94 | + "isChanged": { |
| 95 | + "cmd": "git diff --name-only HEAD@{1} HEAD | grep -q \"^$1\" && exit 0 || exit 1", |
| 96 | + "help": "Check if file changed between last two HEADs." |
| 97 | + }, |
| 98 | + "isDirty": { |
| 99 | + "cmd": "git diff --name-only | grep -q \"^$1\" && exit 0 || exit 1", |
| 100 | + "help": "Check if file has unstaged changes." |
| 101 | + }, |
| 102 | + "isFixup": { |
| 103 | + "cmd": "git log -1 --pretty=%s | grep -q fixup! && exit 0 || exit 1", |
| 104 | + "help": "Check if last commit is a fixup commit." |
| 105 | + }, |
| 106 | + "isRebase": { |
| 107 | + "cmd": "git rev-parse --git-dir | grep -q rebase-merge || git rev-parse --git-dir | grep -q rebase-apply", |
| 108 | + "help": "Check if a rebase is in progress." |
| 109 | + }, |
| 110 | + "pf": { |
| 111 | + "cmd": "git push --force-with-lease", |
| 112 | + "help": "Push with force-with-lease." |
| 113 | + }, |
| 114 | + "refresh": { |
| 115 | + "cmd": "git stash save --keep-index --include-untracked && git reset --hard $(git rev-parse --abbrev-ref --symbolic-full-name @{u})", |
| 116 | + "help": "Stash, reset to upstream, and restore stash." |
| 117 | + }, |
| 118 | + "renameTag": { |
| 119 | + "cmd": "set -e;git tag $2 $1; git tag -d $1;git push origin :refs/tags/$1;git push --tags", |
| 120 | + "help": "Rename a tag locally and remotely." |
| 121 | + }, |
| 122 | + "stack": { |
| 123 | + "cmd": "git diff-index --cached --quiet HEAD || git commit --amend --reset-author --no-edit --no-verify -C HEAD", |
| 124 | + "help": "Amend last commit without editing message." |
| 125 | + }, |
| 126 | + "sync": { |
| 127 | + "cmd": "git fetch --progress --prune --recurse-submodules=no origin && git stash save --keep-index --include-untracked && git merge --ff-only @{u} && git stash pop --index || git stash drop", |
| 128 | + "help": "Fetch, stash, fast-forward merge, and restore stash." |
| 129 | + }, |
| 130 | + "undo": { |
| 131 | + "cmd": "git reset --soft HEAD^ --", |
| 132 | + "help": "Undo last commit, keep changes staged." |
| 133 | + } |
32 | 134 | }
|
0 commit comments