diff --git a/doc/git-a/alias.txt b/doc/git-a/alias.txt new file mode 100644 index 0000000..76d4bb8 --- /dev/null +++ b/doc/git-a/alias.txt @@ -0,0 +1 @@ +add diff --git a/doc/git-a/description.md b/doc/git-a/description.md new file mode 100644 index 0000000..cc84739 --- /dev/null +++ b/doc/git-a/description.md @@ -0,0 +1,7 @@ +Short for `git add`. + +Example: + +```shell +git a file.txt +``` diff --git a/doc/git-a/git-a.gitconfig b/doc/git-a/git-a.gitconfig new file mode 100644 index 0000000..971dd5b --- /dev/null +++ b/doc/git-a/git-a.gitconfig @@ -0,0 +1,2 @@ +[alias] + a = "add" diff --git a/doc/git-aa/alias.txt b/doc/git-aa/alias.txt new file mode 100644 index 0000000..7f9cb38 --- /dev/null +++ b/doc/git-aa/alias.txt @@ -0,0 +1 @@ +add --all diff --git a/doc/git-aa/description.md b/doc/git-aa/description.md new file mode 100644 index 0000000..5c53338 --- /dev/null +++ b/doc/git-aa/description.md @@ -0,0 +1,8 @@ +Short for "git add --all" (add all paths). + +Example: + +```shell +git aa +``` + diff --git a/doc/git-aa/git-aa.gitconfig b/doc/git-aa/git-aa.gitconfig new file mode 100644 index 0000000..0da014a --- /dev/null +++ b/doc/git-aa/git-aa.gitconfig @@ -0,0 +1,2 @@ +[alias] + aa = "add --all" diff --git a/doc/git-add-alias/alias.sh b/doc/git-add-alias/alias.sh new file mode 100644 index 0000000..bb5ea2c --- /dev/null +++ b/doc/git-add-alias/alias.sh @@ -0,0 +1 @@ +f() { if [ $# != 3 ]; then echo "Usage: git add-alias ( --local | --global ) "; echo "Error: this command needs 3 arguments."; return 2; fi; if [ -n "$(git config "$1" --get alias."$2")" ]; then echo "Alias '$2' already exists, thus no change happened."; return 3; fi; git config "$1" alias."$2" "$3" && return 0; echo "Usage: git add-alias ( --local | --global ) "; echo "Error: unknown failure."; return 1; }; f diff --git a/doc/git-add-alias/description.md b/doc/git-add-alias/description.md new file mode 100644 index 0000000..6f67c8d --- /dev/null +++ b/doc/git-add-alias/description.md @@ -0,0 +1,8 @@ +Create a new Git alias. + +Example: + +```shell +git add-alias --local myalias mycommand +git add-alias --global myalias mycommand +``` diff --git a/doc/git-add-cached/alias.sh b/doc/git-add-cached/alias.sh new file mode 100644 index 0000000..af83e32 --- /dev/null +++ b/doc/git-add-cached/alias.sh @@ -0,0 +1 @@ +git add "$(git ls-files --cached | sort -u)" diff --git a/doc/git-add-cached/description.md b/doc/git-add-cached/description.md new file mode 100644 index 0000000..0224d92 --- /dev/null +++ b/doc/git-add-cached/description.md @@ -0,0 +1,29 @@ +Add cached files. + +Example: + +```shell +git add-cached +``` + +Compare: + +* [git add-cached](../git-add-cached) (this alias) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) + +Compare corresponding aliases for `edit-*`: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) diff --git a/doc/git-add-deleted/alias.sh b/doc/git-add-deleted/alias.sh new file mode 100644 index 0000000..ca965f1 --- /dev/null +++ b/doc/git-add-deleted/alias.sh @@ -0,0 +1 @@ +git add "$(git ls-files --deleted | sort -u)" diff --git a/doc/git-add-deleted/description.md b/doc/git-add-deleted/description.md new file mode 100644 index 0000000..7089747 --- /dev/null +++ b/doc/git-add-deleted/description.md @@ -0,0 +1,29 @@ +Add deleted files. + +Example: + +```shell +git add-deleted +``` + +Compare: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) (this alias) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) + +Compare corresponding aliases for `edit-*`: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) diff --git a/doc/git-add-ignored/alias.sh b/doc/git-add-ignored/alias.sh new file mode 100644 index 0000000..b429d60 --- /dev/null +++ b/doc/git-add-ignored/alias.sh @@ -0,0 +1 @@ +git add "$(git ls-files --ignored | sort -u)" diff --git a/doc/git-add-ignored/description.md b/doc/git-add-ignored/description.md new file mode 100644 index 0000000..c25fe82 --- /dev/null +++ b/doc/git-add-ignored/description.md @@ -0,0 +1,29 @@ +Add ignored files. + +Example: + +```shell +git add-ignored +``` + +Compare aliases for `add-*`: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) (this alias) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) + +Compare aliases for `edit-*`: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) diff --git a/doc/git-add-killed/alias.sh b/doc/git-add-killed/alias.sh new file mode 100644 index 0000000..2085c91 --- /dev/null +++ b/doc/git-add-killed/alias.sh @@ -0,0 +1 @@ +git add "$(git ls-files --killed | sort -u)" diff --git a/doc/git-add-killed/description.md b/doc/git-add-killed/description.md new file mode 100644 index 0000000..0c64d20 --- /dev/null +++ b/doc/git-add-killed/description.md @@ -0,0 +1,29 @@ +Add killed files. + +Example: + +```shell +git add-killed +``` + +Compare: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) (this alias) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) + +Compare corresponding aliases for `edit-*`: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) diff --git a/doc/git-add-modified/alias.sh b/doc/git-add-modified/alias.sh new file mode 100644 index 0000000..987c29c --- /dev/null +++ b/doc/git-add-modified/alias.sh @@ -0,0 +1 @@ +git add "$(git ls-files --modified | sort -u)" diff --git a/doc/git-add-modified/description.md b/doc/git-add-modified/description.md new file mode 100644 index 0000000..36acaa0 --- /dev/null +++ b/doc/git-add-modified/description.md @@ -0,0 +1,29 @@ +Add modified files. + +Example: + +```shell +git add-modified +``` + +Compare: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) (this alias) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) + +Compare corresponding aliases for `edit-*`: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) diff --git a/doc/git-add-others/alias.sh b/doc/git-add-others/alias.sh new file mode 100644 index 0000000..492f010 --- /dev/null +++ b/doc/git-add-others/alias.sh @@ -0,0 +1 @@ +git add "$(git ls-files --others | sort -u)" diff --git a/doc/git-add-others/description.md b/doc/git-add-others/description.md new file mode 100644 index 0000000..fe4557e --- /dev/null +++ b/doc/git-add-others/description.md @@ -0,0 +1,29 @@ +Add other files. + +Example: + +```shell +git add-others +``` + +Compare: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) (this alias) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) + +Compare corresponding aliases for `edit-*`: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) diff --git a/doc/git-add-stage/alias.sh b/doc/git-add-stage/alias.sh new file mode 100644 index 0000000..64b7b7f --- /dev/null +++ b/doc/git-add-stage/alias.sh @@ -0,0 +1 @@ +git add "$(git ls-files --stage | cut -f2 | sort -u)" diff --git a/doc/git-add-stage/description.md b/doc/git-add-stage/description.md new file mode 100644 index 0000000..3a0dfa2 --- /dev/null +++ b/doc/git-add-stage/description.md @@ -0,0 +1,29 @@ +Add stage files. + +Example: + +```shell +git add-stage +``` + +Compare: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) (this alias) +* [git add-unmerged](../git-add-unmerged) + +Compare corresponding aliases for `edit-*`: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) diff --git a/doc/git-add-unmerged/alias.sh b/doc/git-add-unmerged/alias.sh new file mode 100644 index 0000000..f640767 --- /dev/null +++ b/doc/git-add-unmerged/alias.sh @@ -0,0 +1 @@ +git add "$(git ls-files --unmerged | cut -f2 | sort -u)" diff --git a/doc/git-add-unmerged/description.md b/doc/git-add-unmerged/description.md new file mode 100644 index 0000000..3958fdd --- /dev/null +++ b/doc/git-add-unmerged/description.md @@ -0,0 +1,29 @@ +Add unmerged files. + +Example: + +```shell +git add-unmerged +``` + +Compare: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) (this alias) +* [git add-unmerged](../git-add-unmerged) + +Compare corresponding aliases for `edit-*`: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) diff --git a/doc/git-add/description.md b/doc/git-add/description.md new file mode 100644 index 0000000..f3cec69 --- /dev/null +++ b/doc/git-add/description.md @@ -0,0 +1,42 @@ +# git add + +## Aliases to add files + + +### Shortcuts + +* [git a](../git-a) = add +* [git aa](../git-aa) = add --all +* [git ap](../git-ap) = add --patch +* [git au](../git-au) = add --update + + +### Add all paths of the given type + +Git alias: + +```git +add-cached = !"f() { git ls-files --cached | sort -u ; }; git add `f`" +add-deleted = !"f() { git ls-files --deleted | sort -u ; }; git add `f`" +add-others = !"f() { git ls-files --others | sort -u ; }; git add `f`" +add-ignored = !"f() { git ls-files --ignored | sort -u ; }; git add `f`" +add-killed = !"f() { git ls-files --killed | sort -u ; }; git add `f`" +add-modified = !"f() { git ls-files --modified | sort -u ; }; git add `f`" +add-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; git add `f`" +add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`" +``` + +Example: + +```shell +git add-cached +git add-deleted +git add-others +git add-ignored +git add-killed +git add-modified +git add-stage +git add-unmerged +``` + +These aliases intentionally match the aliases [git edit-*](../git-edit). diff --git a/doc/git-alias/alias.sh b/doc/git-alias/alias.sh new file mode 100644 index 0000000..cce5251 --- /dev/null +++ b/doc/git-alias/alias.sh @@ -0,0 +1 @@ +f(){ echo "Git Alias is project that has a collection of git alias commands."; echo "The purpose is to help make git easier, faster, and more capable."; echo "Free open source repository ."; echo ""; echo "To see your existing git aliases:"; echo " git aliases"; echo ""; echo "To see your existing git aliases by using git directly:"; echo " git config --get-regexp ^alias\."; };f diff --git a/doc/git-alias/description.md b/doc/git-alias/description.md new file mode 100644 index 0000000..4102b46 --- /dev/null +++ b/doc/git-alias/description.md @@ -0,0 +1,7 @@ +Git alias help. + +Example: + +```shell +git alias +``` diff --git a/doc/git-aliases/alias.sh b/doc/git-aliases/alias.sh new file mode 100644 index 0000000..8b109e7 --- /dev/null +++ b/doc/git-aliases/alias.sh @@ -0,0 +1 @@ +git config --get-regexp '^alias\.' | cut -c 7- | sed 's/ / = /' diff --git a/doc/git-aliases/description.md b/doc/git-aliases/description.md new file mode 100644 index 0000000..2bab211 --- /dev/null +++ b/doc/git-aliases/description.md @@ -0,0 +1,21 @@ +List Git aliases. + +Example: + +```shell +git aliases +``` + +This alias is because friendly wording is easier to remember. + +Our friendly wording for plurals: + +* [git aliases](../git-aliases) + +* [git branches](../git-branches) + +* [git stashes](../git-stashes) + +* [git tags](../git-tags) + +Thanks to . diff --git a/doc/git-ap/alias.txt b/doc/git-ap/alias.txt new file mode 100644 index 0000000..a21923e --- /dev/null +++ b/doc/git-ap/alias.txt @@ -0,0 +1 @@ +add --patch diff --git a/doc/git-ap/description.md b/doc/git-ap/description.md new file mode 100644 index 0000000..a24bbff --- /dev/null +++ b/doc/git-ap/description.md @@ -0,0 +1,9 @@ +Short for "git add --patch" (add by patch). + +Example: + +```shell +git ap +``` + +Show each change, and ask if we want to stage it. diff --git a/doc/git-ap/git-ap.gitconfig b/doc/git-ap/git-ap.gitconfig new file mode 100644 index 0000000..397c7ad --- /dev/null +++ b/doc/git-ap/git-ap.gitconfig @@ -0,0 +1,2 @@ +[alias] + ap = "add --patch" diff --git a/doc/git-archive/alias.sh b/doc/git-archive/alias.sh new file mode 100644 index 0000000..e2deea6 --- /dev/null +++ b/doc/git-archive/alias.sh @@ -0,0 +1 @@ +f() { top="$(rev-parse --show-toplevel)"; cd "$top" || exit 1 ; tar cvf "$top.tar" "$top" ; }; f diff --git a/doc/git-archive/description.md b/doc/git-archive/description.md new file mode 100644 index 0000000..a410d13 --- /dev/null +++ b/doc/git-archive/description.md @@ -0,0 +1,10 @@ +Create an archive file of everything in the repo. + +Example: + +```shell +git archive +``` + +This archive can be useful for backups, disaster recovery, +legal auditing, or sending the repo as a file to someone. diff --git a/doc/git-assume-all/alias.sh b/doc/git-assume-all/alias.sh new file mode 100644 index 0000000..2a35c2a --- /dev/null +++ b/doc/git-assume-all/alias.sh @@ -0,0 +1 @@ +git st -s | awk '{ print $2 }' | xargs -r git assume diff --git a/doc/git-assume-all/description.md b/doc/git-assume-all/description.md new file mode 100644 index 0000000..b313f60 --- /dev/null +++ b/doc/git-assume-all/description.md @@ -0,0 +1,9 @@ +Assume all files are unchanged. + +Example: + +```shell +git assume-all +``` + +To see how this works, see [`git assume-*` and `git unassume-`](../git-assume-and-git-unassume). diff --git a/doc/git-assume-and-git-unassume/description.md b/doc/git-assume-and-git-unassume/description.md new file mode 100644 index 0000000..efc6c66 --- /dev/null +++ b/doc/git-assume-and-git-unassume/description.md @@ -0,0 +1,50 @@ +# git assume-* & git unassume-* + +## Use update-index and assume-unchanged to skip commits + +Git alias: + +```git +assume = update-index --assume-unchanged +assume-all = "!git st -s | awk {'print $2'} | xargs git assume" +assumed = !"git ls-files -v | grep ^h | cut -c 3-" + +unassume = update-index --no-assume-unchanged +unassume-all = "!git assumed | xargs git update-index --no-assume-unchanged" +``` + +Sometimes we want to change a file in a repo, but never check in your edits. + +We can't use .gitignore because the file is tracked. We use update-index. + +If you interact with big corporate projects, such as projects in Subversion, +then you might run into the need to ignore certain files which are under +Subversion control, yet you need to modify them but not commit. +The assume-unchanged flag comes to the rescue. + +Suppose we want to edit the file "passwords.txt" +and also be sure that we never check it in. + +Example: + +```shell +git status +modified passwords.txt +modified foo.txt + +git assume passwords.txt +git status +modified foo.txt + +git assumed +passwords.txt + +git unassume passwords.txt +git status +modified passwords.txt +modified foo.txt +``` + +Thanks + +Thanks diff --git a/doc/git-assume/alias.txt b/doc/git-assume/alias.txt new file mode 100644 index 0000000..d561643 --- /dev/null +++ b/doc/git-assume/alias.txt @@ -0,0 +1 @@ +update-index --assume-unchanged diff --git a/doc/git-assume/description.md b/doc/git-assume/description.md new file mode 100644 index 0000000..e5dcc40 --- /dev/null +++ b/doc/git-assume/description.md @@ -0,0 +1,9 @@ +Assume files are unchanged. + +Example: + +```shell +git assume +``` + +To see how this works, see [`git assume-*` and `git unassume-*`](../git-assume-and-git-unassume). diff --git a/doc/git-assume/git-assume.gitconfig b/doc/git-assume/git-assume.gitconfig new file mode 100644 index 0000000..fbe11e9 --- /dev/null +++ b/doc/git-assume/git-assume.gitconfig @@ -0,0 +1,2 @@ +[alias] + assume = "update-index --assume-unchanged" diff --git a/doc/git-assumed/alias.sh b/doc/git-assumed/alias.sh new file mode 100644 index 0000000..7a3fc56 --- /dev/null +++ b/doc/git-assumed/alias.sh @@ -0,0 +1 @@ +git ls-files -v | grep ^h | cut -c 3- diff --git a/doc/git-assumed/description.md b/doc/git-assumed/description.md new file mode 100644 index 0000000..38a4fa8 --- /dev/null +++ b/doc/git-assumed/description.md @@ -0,0 +1,9 @@ +Show which files are assumed. + +Example: + +```shell +git assumed +``` + +To see how this works, see [`git assume-*` and `git unassume-*`](../git-assume-and-git-unassume). diff --git a/doc/git-au/alias.txt b/doc/git-au/alias.txt new file mode 100644 index 0000000..d0ee5ed --- /dev/null +++ b/doc/git-au/alias.txt @@ -0,0 +1 @@ +add --update diff --git a/doc/git-au/description.md b/doc/git-au/description.md new file mode 100644 index 0000000..4bc72f6 --- /dev/null +++ b/doc/git-au/description.md @@ -0,0 +1,26 @@ +Short for `git add --update`. + +Add just the files that are updated. + +Example: + +```shell +git au +``` + +### Documentation + +
+ +
-u, --update
+ +
+ +Update the index just where it already has an entry matching <pathspec>. This removes as well as modifies index entries to match the working tree, but adds no new files. + +If no <pathspec> is given when -u option is used, all tracked files in the entire working tree are updated (old versions of Git used to limit the update to the current +directory and its subdirectories). + +
+ +
diff --git a/doc/git-au/git-au.gitconfig b/doc/git-au/git-au.gitconfig new file mode 100644 index 0000000..be79f9d --- /dev/null +++ b/doc/git-au/git-au.gitconfig @@ -0,0 +1,2 @@ +[alias] + au = "add --update" diff --git a/doc/git-b/alias.txt b/doc/git-b/alias.txt new file mode 100644 index 0000000..80858c1 --- /dev/null +++ b/doc/git-b/alias.txt @@ -0,0 +1 @@ +branch diff --git a/doc/git-b/description.md b/doc/git-b/description.md new file mode 100644 index 0000000..ff37c61 --- /dev/null +++ b/doc/git-b/description.md @@ -0,0 +1,7 @@ +Short for `git branch`. + +Example: + +```shell +git b +``` diff --git a/doc/git-b/git-b.gitconfig b/doc/git-b/git-b.gitconfig new file mode 100644 index 0000000..8aba52f --- /dev/null +++ b/doc/git-b/git-b.gitconfig @@ -0,0 +1,2 @@ +[alias] + b = "branch" diff --git a/doc/git-bed/alias.txt b/doc/git-bed/alias.txt new file mode 100644 index 0000000..6851860 --- /dev/null +++ b/doc/git-bed/alias.txt @@ -0,0 +1 @@ +branch --edit-description diff --git a/doc/git-bed/description.md b/doc/git-bed/description.md new file mode 100644 index 0000000..4897eb5 --- /dev/null +++ b/doc/git-bed/description.md @@ -0,0 +1,9 @@ +Edit the description of a branch. + +Example: + +```shell +git bed +``` + +Compare [`git bsd`](../git-bsd) in order to show the branch description. diff --git a/doc/git-bed/git-bed.gitconfig b/doc/git-bed/git-bed.gitconfig new file mode 100644 index 0000000..b4d6d02 --- /dev/null +++ b/doc/git-bed/git-bed.gitconfig @@ -0,0 +1,2 @@ +[alias] + bed = "branch --edit-description" diff --git a/doc/git-bm/alias.txt b/doc/git-bm/alias.txt new file mode 100644 index 0000000..b4573f6 --- /dev/null +++ b/doc/git-bm/alias.txt @@ -0,0 +1 @@ +branch --merged diff --git a/doc/git-bm/description.md b/doc/git-bm/description.md new file mode 100644 index 0000000..0378b94 --- /dev/null +++ b/doc/git-bm/description.md @@ -0,0 +1,3 @@ +List branches whose tips are reachable from the specified commit (HEAD if not specified). + +Compare [`bnm`](../git-bnm). diff --git a/doc/git-bm/git-bm.gitconfig b/doc/git-bm/git-bm.gitconfig new file mode 100644 index 0000000..bf3e7e2 --- /dev/null +++ b/doc/git-bm/git-bm.gitconfig @@ -0,0 +1,2 @@ +[alias] + bm = "branch --merged" diff --git a/doc/git-bnm/alias.txt b/doc/git-bnm/alias.txt new file mode 100644 index 0000000..81a4d59 --- /dev/null +++ b/doc/git-bnm/alias.txt @@ -0,0 +1 @@ +branch --no-merged diff --git a/doc/git-bnm/description.md b/doc/git-bnm/description.md new file mode 100644 index 0000000..2738c0c --- /dev/null +++ b/doc/git-bnm/description.md @@ -0,0 +1,3 @@ +List branches whose tips are not reachable from the specified commit (HEAD if not specified). + +Compare [`bm`](../git-bm). diff --git a/doc/git-bnm/git-bnm.gitconfig b/doc/git-bnm/git-bnm.gitconfig new file mode 100644 index 0000000..67d4038 --- /dev/null +++ b/doc/git-bnm/git-bnm.gitconfig @@ -0,0 +1,2 @@ +[alias] + bnm = "branch --no-merged" diff --git a/doc/git-branch-commit-first/alias.sh b/doc/git-branch-commit-first/alias.sh new file mode 100644 index 0000000..22b6e38 --- /dev/null +++ b/doc/git-branch-commit-first/alias.sh @@ -0,0 +1 @@ +f() { branch="${1:-$(git current-branch)}"; count="${2:-1}"; git log --reverse --pretty=%H "$branch" | head -"$count"; }; f diff --git a/doc/git-branch-commit-first/description.md b/doc/git-branch-commit-first/description.md new file mode 100644 index 0000000..682c5d9 --- /dev/null +++ b/doc/git-branch-commit-first/description.md @@ -0,0 +1,39 @@ +Show a branch's first commit hash (or hashes). + +Syntax: + +```shell +git branch-commit-first [branch name [commit count]] +``` + +Options: + + * branch name: default is the current branch name. + + * commit count: default is 1 + +Example: show the current branch's first commit hash: + +```shell +git branch-commit-first +``` + +Example: show the "foo" branch's first commit hash: + +```shell +git branch-commit-first foo +``` + +Example: show the "foo" branch's first 3 commit hashes: + +```shell +git branch-commit-first foo 3 +``` + +Compare: + +* [git branch-commit-first](../git-branch-commit-first): show a branch's first commit hash (or hashes) +* [git branch-commit-last](../git-branch-commit-last): show a branch's last commit hash (or hashes) +* [git branch-commit-prev](../git-branch-commit-prev): show a branch's previous commit hash (or hashes) +* [git branch-commit-next](../git-branch-commit-next): show a branch's next commit hash (or hashes) + diff --git a/doc/git-branch-commit-last/alias.sh b/doc/git-branch-commit-last/alias.sh new file mode 100644 index 0000000..fa479d7 --- /dev/null +++ b/doc/git-branch-commit-last/alias.sh @@ -0,0 +1 @@ +f() { branch="${1:-$(git current-branch)}"; count="${2:-1}"; git log --pretty=%H "$branch" | head -"$count"; }; f diff --git a/doc/git-branch-commit-last/description.md b/doc/git-branch-commit-last/description.md new file mode 100644 index 0000000..9f99e28 --- /dev/null +++ b/doc/git-branch-commit-last/description.md @@ -0,0 +1,38 @@ +Show a branch's last commit hash (or hashes). + +Syntax: + +```shell +git branch-commit-last [branch name [commit count]] +``` + +Options: + + * branch name: default is the current branch name. + + * commit count: default is 1 + +Example: show the current branch's last commit hash: + +```shell +git branch-commit-last +``` + +Example: show the "foo" branch's last commit hash: + +```shell +git branch-commit-last foo +``` + +Example: show the "foo" branch's last 3 commit hashes: + +```shell +git branch-commit-last foo 3 +``` + +Compare: + +* [git branch-commit-first](../git-branch-commit-first): show a branch's first commit hash (or hashes) +* [git branch-commit-last](../git-branch-commit-last): show a branch's last commit hash (or hashes) +* [git branch-commit-prev](../git-branch-commit-prev): show a branch's previous commit hash (or hashes) +* [git branch-commit-next](../git-branch-commit-next): show a branch's next commit hash (or hashes) diff --git a/doc/git-branch-commit-next/alias.sh b/doc/git-branch-commit-next/alias.sh new file mode 100644 index 0000000..335d896 --- /dev/null +++ b/doc/git-branch-commit-next/alias.sh @@ -0,0 +1 @@ +f() { branch="${1:-$(git current-branch)}"; count="${2:-1}"; git log --reverse --pretty=%H "$branch" | grep -A "$count" "$(git rev-parse HEAD)" | tail +2; }; f diff --git a/doc/git-branch-commit-next/description.md b/doc/git-branch-commit-next/description.md new file mode 100644 index 0000000..ff3757c --- /dev/null +++ b/doc/git-branch-commit-next/description.md @@ -0,0 +1,38 @@ +Show a branch's next commit hash (or hashes). + +Syntax: + +```shell +git branch-commit-next [branch name [commit count]] +``` + +Options: + + * branch name: default is the current branch name. + + * commit count: default is 1 + +Example: show the current branch's next commit hash: + +```shell +git branch-commit-next +``` + +Example: show the "foo" branch's next commit hash: + +```shell +git branch-commit-next next +``` + +Example: show the "foo" branch's next 3 commit hashes: + +```shell +git branch-commit-next foo 3 +``` + +Compare: + +* [git branch-commit-first](../git-branch-commit-first): show a branch's first commit hash (or hashes) +* [git branch-commit-last](../git-branch-commit-last): show a branch's last commit hash (or hashes) +* [git branch-commit-prev](../git-branch-commit-prev): show a branch's previous commit hash (or hashes) +* [git branch-commit-next](../git-branch-commit-next): show a branch's next commit hash (or hashes) diff --git a/doc/git-branch-commit-prev/alias.sh b/doc/git-branch-commit-prev/alias.sh new file mode 100644 index 0000000..8a2a382 --- /dev/null +++ b/doc/git-branch-commit-prev/alias.sh @@ -0,0 +1 @@ +f() { branch="${1:-$(git current-branch)}"; count="${2:-1}"; git log --pretty=%H "$branch" | grep -A "$count" "$(git rev-parse HEAD)" | tail +2; }; f diff --git a/doc/git-branch-commit-prev/description.md b/doc/git-branch-commit-prev/description.md new file mode 100644 index 0000000..819c5da --- /dev/null +++ b/doc/git-branch-commit-prev/description.md @@ -0,0 +1,38 @@ +Show a branch's previous commit hash (or hashes) + +Syntax: + +```shell +git branch-commit-prev [branch name [commit count]] +``` + +Options: + + * branch name: default is the current branch name. + + * commit count: default is 1 + +Example: show the current branch's previous commit hash: + +```shell +git branch-commit-prev +``` + +Example: show the "foo" branch's previous commit hash: + +```shell +git branch-commit-prev previous +``` + +Example: show the "foo" branch's previous 3 commit hashes: + +```shell +git branch-commit-prev foo 3 +``` + +Compare: + +* [git branch-commit-first](../git-branch-commit-first): show a branch's first commit hash (or hashes) +* [git branch-commit-last](../git-branch-commit-last): show a branch's last commit hash (or hashes) +* [git branch-commit-prev](../git-branch-commit-prev): show a branch's previous commit hash (or hashes) +* [git branch-commit-next](../git-branch-commit-next): show a branch's next commit hash (or hashes) diff --git a/doc/git-branch-commit/description.md b/doc/git-branch-commit/description.md new file mode 100644 index 0000000..a453a16 --- /dev/null +++ b/doc/git-branch-commit/description.md @@ -0,0 +1,14 @@ +# git-branch-commit-* + +## Show a branch's commit hash via ordering + +* [git branch-commit-first](../git-branch-commit-first): show a branch's first commit hash (or hashes) +* [git branch-commit-last](../git-branch-commit-last): show a branch's last commit hash (or hashes) +* [git branch-commit-prev](../git-branch-commit-prev): show a branch's previous commit hash (or hashes) +* [git branch-commit-next](../git-branch-commit-next): show a branch's next commit hash (or hashes) + +Inspirations: + + * Email from Demian proposing these aliases + + * diff --git a/doc/git-branch/description.md b/doc/git-branch/description.md new file mode 100644 index 0000000..faf64ec --- /dev/null +++ b/doc/git-branch/description.md @@ -0,0 +1,38 @@ +# git branch + +## Aliases related to git branch + + +### Shortcuts + +* [git b](git-b) = branch +* [git bm](git-bm) = branch --merged +* [git bnm](git-bm) = branch --no-merged +* [git bed](git-bed) = branch --edit-description +* [git bsd](git-bsd) = branch --show-description (wishlist) + + +### Branch names + +* [git default-branch](git-default-branch) - Get the default branch name. +* [git current-branch](git-current-branch) - Get the current branch name. +* [git upstream-branch](git-upstream-branch) - Get the upstream branch name. +* [git topic-base-branch](git-topic-base-branch) - Get the topic base branch name. + + +### Branch commits + +* [git branch-commit-first](../git-branch-commit-first) - Show a branch's first commit hash (or hashes). +* [git branch-commit-last](../git-branch-commit-last) - Show a branch's last commit hash (or hashes). +* [git branch-commit-prev](../git-branch-commit-prev) - Show a branch's previous commit hash (or hashes). +* [git branch-commit-next](../git-branch-commit-next) - Show a branch's next commit hash (or hashes). + + +### Topic branches + +* [git topic-*](git-topic) - Read this first about topic branches. +* [git topic-base-branch](git-topic-base-branch) - Show the topic base branch name. +* [git topic-begin](git-topic-begin) - Start a new topic branch. +* [git topic-end](git-topic-end) - Finish the current topic branch. +* [git topic-sync](git-topic-sync) - Synchronize the current topic branch. +* [git topic-move](git-topic-move) - Rename the current topic branch. diff --git a/doc/git-branches/alias.txt b/doc/git-branches/alias.txt new file mode 100644 index 0000000..da85c79 --- /dev/null +++ b/doc/git-branches/alias.txt @@ -0,0 +1 @@ +branch -a diff --git a/doc/git-branches/description.md b/doc/git-branches/description.md new file mode 100644 index 0000000..065e95a --- /dev/null +++ b/doc/git-branches/description.md @@ -0,0 +1,15 @@ +List branches. + +This alias is because friendly wording is easier to remember. + +Our friendly wording for plurals: + +* [git aliases](../git-aliases) + +* [git branches](../git-branches) + +* [git stashes](../git-stashes) + +* [git tags](../git-tags) + +Thanks to . diff --git a/doc/git-branches/git-branches.gitconfig b/doc/git-branches/git-branches.gitconfig new file mode 100644 index 0000000..13358e9 --- /dev/null +++ b/doc/git-branches/git-branches.gitconfig @@ -0,0 +1,2 @@ +[alias] + branches = "branch -a" diff --git a/doc/git-bsd/alias.sh b/doc/git-bsd/alias.sh new file mode 100644 index 0000000..8527e00 --- /dev/null +++ b/doc/git-bsd/alias.sh @@ -0,0 +1 @@ +f(){ branch="${1:-$(git rev-parse --abbrev-ref HEAD 2>/dev/null)}"; git config "branch.$branch.description"; };f diff --git a/doc/git-bsd/description.md b/doc/git-bsd/description.md new file mode 100644 index 0000000..5f9a484 --- /dev/null +++ b/doc/git-bsd/description.md @@ -0,0 +1,13 @@ +Show the description of a branch. + +Example: + +```shell +git bsd +This is an example branch +``` + +We advocate for Git authors to add this feature +in the future as `git --show-description` + +Compare [`git bed`](../git-bed) in order to edit the branch description. diff --git a/doc/git-bv/alias.txt b/doc/git-bv/alias.txt new file mode 100644 index 0000000..d5a51e6 --- /dev/null +++ b/doc/git-bv/alias.txt @@ -0,0 +1 @@ +branch --verbose diff --git a/doc/git-bv/description.md b/doc/git-bv/description.md new file mode 100644 index 0000000..db5f277 --- /dev/null +++ b/doc/git-bv/description.md @@ -0,0 +1,17 @@ +List branch information with hash and subject. + +Example: + +```shell +git bv +``` + +When in list mode, then show the hash, the commit subject line, etc. + +This is identical to doing `git b -v`. + +Compare these: + +* [git b](../git-b) +* [git bv](../git-bv) (this alias) +* [git bvv](../git-bvv) diff --git a/doc/git-bv/git-bv.gitconfig b/doc/git-bv/git-bv.gitconfig new file mode 100644 index 0000000..cb3b06a --- /dev/null +++ b/doc/git-bv/git-bv.gitconfig @@ -0,0 +1,2 @@ +[alias] + bv = "branch --verbose" diff --git a/doc/git-bvv/alias.txt b/doc/git-bvv/alias.txt new file mode 100644 index 0000000..54d5b63 --- /dev/null +++ b/doc/git-bvv/alias.txt @@ -0,0 +1 @@ +branch --verbose --verbose diff --git a/doc/git-bvv/description.md b/doc/git-bvv/description.md new file mode 100644 index 0000000..d24942f --- /dev/null +++ b/doc/git-bvv/description.md @@ -0,0 +1,17 @@ +List branch information with hash and subject and upstream + +Example: + +```shell +git bvv +``` + +When in list mode, then show the hash, the commit subject line, the upstream branch, etc. + +This is identical to doing `git b -vv`. + +Compare: + +* [git b](../git-b) +* [git bv](../git-bv) +* [git bvv](../git-bvv) (this alias) diff --git a/doc/git-bvv/git-bvv.gitconfig b/doc/git-bvv/git-bvv.gitconfig new file mode 100644 index 0000000..5ad9f83 --- /dev/null +++ b/doc/git-bvv/git-bvv.gitconfig @@ -0,0 +1,2 @@ +[alias] + bvv = "branch --verbose --verbose" diff --git a/doc/git-c/alias.txt b/doc/git-c/alias.txt new file mode 100644 index 0000000..01f9a2a --- /dev/null +++ b/doc/git-c/alias.txt @@ -0,0 +1 @@ +commit diff --git a/doc/git-c/description.md b/doc/git-c/description.md new file mode 100644 index 0000000..38fe155 --- /dev/null +++ b/doc/git-c/description.md @@ -0,0 +1,7 @@ +Short for "git commit". + +Example: + +```shell +git c +``` diff --git a/doc/git-c/git-c.gitconfig b/doc/git-c/git-c.gitconfig new file mode 100644 index 0000000..bc7ff90 --- /dev/null +++ b/doc/git-c/git-c.gitconfig @@ -0,0 +1,2 @@ +[alias] + c = "commit" diff --git a/doc/git-ca/alias.txt b/doc/git-ca/alias.txt new file mode 100644 index 0000000..d8c8e92 --- /dev/null +++ b/doc/git-ca/alias.txt @@ -0,0 +1 @@ +commit --amend diff --git a/doc/git-ca/description.md b/doc/git-ca/description.md new file mode 100644 index 0000000..819368b --- /dev/null +++ b/doc/git-ca/description.md @@ -0,0 +1,7 @@ +Amend the tip of the current branch; do not create a new commit. + +Example: + +```shell +git ca +``` diff --git a/doc/git-ca/git-ca.gitconfig b/doc/git-ca/git-ca.gitconfig new file mode 100644 index 0000000..1ddb2f0 --- /dev/null +++ b/doc/git-ca/git-ca.gitconfig @@ -0,0 +1,2 @@ +[alias] + ca = "commit --amend" diff --git a/doc/git-caa/alias.txt b/doc/git-caa/alias.txt new file mode 100644 index 0000000..063e2b3 --- /dev/null +++ b/doc/git-caa/alias.txt @@ -0,0 +1 @@ +commit --amend --all diff --git a/doc/git-caa/description.md b/doc/git-caa/description.md new file mode 100644 index 0000000..5facbb9 --- /dev/null +++ b/doc/git-caa/description.md @@ -0,0 +1,7 @@ +Amend the tip of the current branch, automatically staging files that have been modified and deleted. + +Example: + +```shell +git caa +``` diff --git a/doc/git-caa/git-caa.gitconfig b/doc/git-caa/git-caa.gitconfig new file mode 100644 index 0000000..8c1abe5 --- /dev/null +++ b/doc/git-caa/git-caa.gitconfig @@ -0,0 +1,2 @@ +[alias] + caa = "commit --amend --all" diff --git a/doc/git-caam/alias.txt b/doc/git-caam/alias.txt new file mode 100644 index 0000000..22e25a9 --- /dev/null +++ b/doc/git-caam/alias.txt @@ -0,0 +1 @@ +commit --amend --all --message diff --git a/doc/git-caam/description.md b/doc/git-caam/description.md new file mode 100644 index 0000000..fb88411 --- /dev/null +++ b/doc/git-caam/description.md @@ -0,0 +1,7 @@ +Amend the tip of the current branch, staging files, and edit the message. + +Example: + +```shell +git caam +``` diff --git a/doc/git-caam/git-caam.gitconfig b/doc/git-caam/git-caam.gitconfig new file mode 100644 index 0000000..a342c97 --- /dev/null +++ b/doc/git-caam/git-caam.gitconfig @@ -0,0 +1,2 @@ +[alias] + caam = "commit --amend --all --message" diff --git a/doc/git-caane/alias.txt b/doc/git-caane/alias.txt new file mode 100644 index 0000000..a005cbd --- /dev/null +++ b/doc/git-caane/alias.txt @@ -0,0 +1 @@ +commit --amend --all --no-edit diff --git a/doc/git-caane/description.md b/doc/git-caane/description.md new file mode 100644 index 0000000..4339bbd --- /dev/null +++ b/doc/git-caane/description.md @@ -0,0 +1,7 @@ +Amend the tip of the current branch, staging files, and do not edit the message. + +Example: + +```shell +git caane +``` diff --git a/doc/git-caane/git-caane.gitconfig b/doc/git-caane/git-caane.gitconfig new file mode 100644 index 0000000..c77cab0 --- /dev/null +++ b/doc/git-caane/git-caane.gitconfig @@ -0,0 +1,2 @@ +[alias] + caane = "commit --amend --all --no-edit" diff --git a/doc/git-cam/alias.txt b/doc/git-cam/alias.txt new file mode 100644 index 0000000..27e3d46 --- /dev/null +++ b/doc/git-cam/alias.txt @@ -0,0 +1 @@ +commit --amend --message diff --git a/doc/git-cam/description.md b/doc/git-cam/description.md new file mode 100644 index 0000000..a6506aa --- /dev/null +++ b/doc/git-cam/description.md @@ -0,0 +1,7 @@ +Amend the tip of the current branch; edit the message. + +Example: + +```shell +git cam +``` diff --git a/doc/git-cam/git-cam.gitconfig b/doc/git-cam/git-cam.gitconfig new file mode 100644 index 0000000..8d3aac9 --- /dev/null +++ b/doc/git-cam/git-cam.gitconfig @@ -0,0 +1,2 @@ +[alias] + cam = "commit --amend --message" diff --git a/doc/git-cane/alias.txt b/doc/git-cane/alias.txt new file mode 100644 index 0000000..82b10a3 --- /dev/null +++ b/doc/git-cane/alias.txt @@ -0,0 +1 @@ +commit --amend --no-edit diff --git a/doc/git-cane/description.md b/doc/git-cane/description.md new file mode 100644 index 0000000..c1365f0 --- /dev/null +++ b/doc/git-cane/description.md @@ -0,0 +1,7 @@ +Amend the tip of the current branch, with no edit of the message. + +Example: + +```shell +git cane +``` diff --git a/doc/git-cane/git-cane.gitconfig b/doc/git-cane/git-cane.gitconfig new file mode 100644 index 0000000..1e89875 --- /dev/null +++ b/doc/git-cane/git-cane.gitconfig @@ -0,0 +1,2 @@ +[alias] + cane = "commit --amend --no-edit" diff --git a/doc/git-chart/alias.sh b/doc/git-chart/alias.sh new file mode 100644 index 0000000..9735976 --- /dev/null +++ b/doc/git-chart/alias.sh @@ -0,0 +1 @@ +f() { git log --format=oneline --format="%aE %at" --since=6-weeks-ago "$*" | awk ' function time_to_slot(t) { return strftime("%Y-%m-%d", t, true) } function count_to_char(i) { return (i > 0) ? ((i < 10) ? i : "X") : "." } BEGIN { time_min = systime(); time_max = 0; SECONDS_PER_DAY=86400; } { item = $1; time = 0 + $2; if (time > time_max){ time_max = time } else if (time < time_min){ time_min = time }; slot = time_to_slot(time); items[item]++; slots[slot]++; views[item, slot]++; } END{ printf("Chart time range %s to %s.\n", time_to_slot(time_min), time_to_slot(time_max)); time_max_add = time_max += SECONDS_PER_DAY; for(item in items){ row = ""; for(time = time_min; time < time_max_add; time += SECONDS_PER_DAY) { slot = time_to_slot(time); count = views[item, slot]; row = row count_to_char(count); } print row, item; } }'; }; f diff --git a/doc/git-chart/description.md b/doc/git-chart/description.md new file mode 100644 index 0000000..12c0dbb --- /dev/null +++ b/doc/git-chart/description.md @@ -0,0 +1,47 @@ +Show highlights chart of activity per author. + +Example: + +```shell +git chart +..X..........X...2..12 alice@example.com +....2..2..13.......... bob@example.com +2.....1....11......... carol@example.com +..1............1..1... david@example.com +....1.......1.3.3.22.2 eve@example.com +``` + +The chart rows are the authors. + +The chart columns are the days. + +The chart column prints one character per day: + + * For 1-9 commits, show the number. + + * For 10 or more commits, show "X" as a visual indicator. + + * For no commits, show "." as a visual placeholder. + +The chart timeline adjusts the date range automatically: + + * The timeline starts with the date of the earliest commit. + + * The timeline stops with the date of the latest commit. + + * The intent is to show the most relevant information. + +The chart default is to look at the past 6 weeks; +this gives a good balance of recency and speed +for a team that's currently working on a repo, +and also gives a good balance of fitting within +one terminal window 80 character width. + +You can adjust how far back the chart looks, +by providing your own `--since` parameter. +For example if you want to chart an older repo, +that does not have any recent commits, then you +you must provide a longer `--since` parameter. + +TODO: sort the rows meaningfully, +such as alphabetically, or by count. diff --git a/doc/git-cherry-pick-merge/alias.sh b/doc/git-cherry-pick-merge/alias.sh new file mode 100644 index 0000000..1ba8470 --- /dev/null +++ b/doc/git-cherry-pick-merge/alias.sh @@ -0,0 +1 @@ +sh -c 'git cherry-pick --no-commit --mainline 1 $0 && git log -1 --pretty=%P $0 | cut -b 42- > .git/MERGE_HEAD && git commit --verbose' diff --git a/doc/git-cherry-pick-merge/description.md b/doc/git-cherry-pick-merge/description.md new file mode 100644 index 0000000..5834e8f --- /dev/null +++ b/doc/git-cherry-pick-merge/description.md @@ -0,0 +1,9 @@ +Cherry pick a merge commit. + +Example: + +```shell +git cherry-pick-merge +``` + +Thanks to Cody Cutrer. diff --git a/doc/git-churn/alias.sh b/doc/git-churn/alias.sh new file mode 100644 index 0000000..fcb2bf4 --- /dev/null +++ b/doc/git-churn/alias.sh @@ -0,0 +1 @@ +f() { git log --all --find-copies --find-renames --name-only --format='format:' "$@" | awk 'NF{a[$0]++}END{for(i in a){print a[i], i}}' | sort -rn;};f diff --git a/doc/git-churn/description.md b/doc/git-churn/description.md new file mode 100644 index 0000000..8433603 --- /dev/null +++ b/doc/git-churn/description.md @@ -0,0 +1,61 @@ +Show log of files that have many changes. + +Show churn for whole repo: + +```shell +git churn +``` + +Show churn for specific directories: + +```shell +git churn app lib +``` + +Show churn for a time range: + +```shell +git churn --since=1-month-ago +``` + +These are all standard arguments to `git log`. + +It's possible to get valuable insight from history of a project not only +by viewing individual commits, but by analyzing sets of changes as a whole. + +For instance, `git churn` compiles stats about which files change the most. + +For example, to see where work on an app was focused on in the past month: + +```shell +git churn --since=1-month-ago app/ | tail +``` + +This can also highlight potential problems with technical debt in a project. +A specific file changing too often is generally a red flag, since it probably +means the file either needed to be frequently fixed for bugs, or the file +holds too much responsibility and should be split into smaller units. + +Similar methods of history analysis can be employed to see which people were +responsible recently for development of a certain part of the codebase. + +For instance, to see who contributed most to the API part of an application: + +```shell +git log --format='%an' --since=1-month-ago app/controllers/api/ | sort | uniq -c | sort -rn | head +109 Alice Anderson +13 Bob Brown +7 Carol Clark +``` + +Credit: + +* Written by [Corey Haines](http://coreyhaines.com/) + +* Scriptified by Gary Bernhardt + +* Obtained from + +* Comments by Mislav + +* Edited for GitAlias.com repo by Joel Parker Henderson diff --git a/doc/git-ci/alias.txt b/doc/git-ci/alias.txt new file mode 100644 index 0000000..987750c --- /dev/null +++ b/doc/git-ci/alias.txt @@ -0,0 +1 @@ +commit --interactive diff --git a/doc/git-ci/description.md b/doc/git-ci/description.md new file mode 100644 index 0000000..3816f7f --- /dev/null +++ b/doc/git-ci/description.md @@ -0,0 +1,7 @@ +Commit interactively. + +Example: + +```shell +git ci +``` diff --git a/doc/git-ci/git-ci.gitconfig b/doc/git-ci/git-ci.gitconfig new file mode 100644 index 0000000..c1f7b47 --- /dev/null +++ b/doc/git-ci/git-ci.gitconfig @@ -0,0 +1,2 @@ +[alias] + ci = "commit --interactive" diff --git a/doc/git-cleaner/alias.txt b/doc/git-cleaner/alias.txt new file mode 100644 index 0000000..61c71f1 --- /dev/null +++ b/doc/git-cleaner/alias.txt @@ -0,0 +1 @@ +clean -dff diff --git a/doc/git-cleaner/description.md b/doc/git-cleaner/description.md new file mode 100644 index 0000000..13a1d11 --- /dev/null +++ b/doc/git-cleaner/description.md @@ -0,0 +1,20 @@ +Clean a working tree using more powerful options. + +Example: + +```shell +git cleaner +``` + +This will remove untracked files from the working tree. + + +### Documentation of `git clean` flags + +
+
-d
+
Normally, when no <path> is specified, git clean will not recurse into untracked directories to avoid removing too much. Specify -d to have it recurse into such directories as well. If any paths are specified, -d is irrelevant; all untracked files matching the specified paths (with exceptions for nested git directories mentioned under --force) will be removed.
+
-f, --force
+
If the Git configuration variable clean.requireForce is not set to false, git clean will refuse to delete files or directories unless given -f or -i. Git will refuse to modify untracked nested git repositories (directories with a +.git subdirectory) unless a second -f is given.
+
diff --git a/doc/git-cleaner/git-cleaner.gitconfig b/doc/git-cleaner/git-cleaner.gitconfig new file mode 100644 index 0000000..c8ea580 --- /dev/null +++ b/doc/git-cleaner/git-cleaner.gitconfig @@ -0,0 +1,2 @@ +[alias] + cleaner = "clean -dff" diff --git a/doc/git-cleanest/alias.txt b/doc/git-cleanest/alias.txt new file mode 100644 index 0000000..45957b3 --- /dev/null +++ b/doc/git-cleanest/alias.txt @@ -0,0 +1 @@ +clean -dffx diff --git a/doc/git-cleanest/description.md b/doc/git-cleanest/description.md new file mode 100644 index 0000000..bd7e465 --- /dev/null +++ b/doc/git-cleanest/description.md @@ -0,0 +1,23 @@ +Clean a working tree using the most powerful options. + +Example: + +```shell +git cleanest +``` + +This will remove untracked files from the working tree. + + +### Documentation of `git clean` flags + +
+
-d
+
Normally, when no <path> is specified, git clean will not recurse into untracked directories to avoid removing too much. Specify -d to have it recurse into such directories as well. If any paths are specified, -d is irrelevant; all untracked files matching the specified paths (with exceptions for nested git directories mentioned under --force) will be removed.
+
-f, --force
+
If the Git configuration variable clean.requireForce is not set to false, git clean will refuse to delete files or directories unless given -f or -i. Git will refuse to modify untracked nested git repositories (directories with a +.git subdirectory) unless a second -f is given.
+
-x
+
Don't use the standard ignore rules (see gitignore(5)), but still use the ignore rules given with -e options from the command line. This allows removing all untracked files, including build products. This can be used (possibly in +conjunction with git restore or git reset) to create a pristine working directory to test a clean build.
+
diff --git a/doc/git-cleanest/git-cleanest.gitconfig b/doc/git-cleanest/git-cleanest.gitconfig new file mode 100644 index 0000000..3d52ef9 --- /dev/null +++ b/doc/git-cleanest/git-cleanest.gitconfig @@ -0,0 +1,2 @@ +[alias] + cleanest = "clean -dffx" diff --git a/doc/git-cleanout/alias.sh b/doc/git-cleanout/alias.sh new file mode 100644 index 0000000..705d9c9 --- /dev/null +++ b/doc/git-cleanout/alias.sh @@ -0,0 +1 @@ +git clean -df && git checkout -- . diff --git a/doc/git-cleanout/description.md b/doc/git-cleanout/description.md new file mode 100644 index 0000000..4e0c6af --- /dev/null +++ b/doc/git-cleanout/description.md @@ -0,0 +1,7 @@ +Clean a working tree using typical options then checkout. + +Example: + +```shell +git cleanout +``` diff --git a/doc/git-clone-lean/alias.txt b/doc/git-clone-lean/alias.txt new file mode 100644 index 0000000..f72f825 --- /dev/null +++ b/doc/git-clone-lean/alias.txt @@ -0,0 +1 @@ +clone --depth 1 --filter=combine:blob:none+tree:0 --no-checkout diff --git a/doc/git-clone-lean/description.md b/doc/git-clone-lean/description.md new file mode 100644 index 0000000..d7f91db --- /dev/null +++ b/doc/git-clone-lean/description.md @@ -0,0 +1,37 @@ +Clone as lean as possible. + +Example: + +```shell +git clone-lean +``` + +This alias skips fetching unneeded objects from the server. + +This is good to checkout just one subdirectory. + +Command breakdown: + + * --depth 1 does a shallow clone and implies --single-branches + + * --filter=blob:none skips all blobs, but fetches all tree objects + + * --filter=tree:0 skips unneeded trees + + * --filter=combine:FILTER1+FILTER2 is the syntax to use multiple + filters at once; trying to pass --filter multiple times fails + with: "multiple filter-specs cannot be combined". + +This uses --filter=tree:0 added in Git 2.20 and --filter=combine +composite filter added in Git 2.24. + +The server should be configured with: + + git config --local uploadpack.allowfilter 1 + git config --local uploadpack.allowanysha1inwant 1 + +An extension was made to the Git remote protocol to support this +feature in v2.19.0 and actually skip fetching unneeded objects. +There was server support then, but it can be locally tested. + +Credit diff --git a/doc/git-clone-lean/git-clone-lean.gitconfig b/doc/git-clone-lean/git-clone-lean.gitconfig new file mode 100644 index 0000000..fc463ba --- /dev/null +++ b/doc/git-clone-lean/git-clone-lean.gitconfig @@ -0,0 +1,2 @@ +[alias] + clone-lean = "clone --depth 1 --filter=combine:blob:none+tree:0 --no-checkout" diff --git a/doc/git-cloner/alias.txt b/doc/git-cloner/alias.txt new file mode 100644 index 0000000..70dc2ff --- /dev/null +++ b/doc/git-cloner/alias.txt @@ -0,0 +1 @@ +clone --recursive diff --git a/doc/git-cloner/description.md b/doc/git-cloner/description.md new file mode 100644 index 0000000..e20d313 --- /dev/null +++ b/doc/git-cloner/description.md @@ -0,0 +1,7 @@ +Clone a repository using our recommended way, i.e. recurse on all submodules. + +Example: + +```shell +git cloner +``` diff --git a/doc/git-cloner/git-cloner.gitconfig b/doc/git-cloner/git-cloner.gitconfig new file mode 100644 index 0000000..493d460 --- /dev/null +++ b/doc/git-cloner/git-cloner.gitconfig @@ -0,0 +1,2 @@ +[alias] + cloner = "clone --recursive" diff --git a/doc/git-cm/alias.txt b/doc/git-cm/alias.txt new file mode 100644 index 0000000..5af9efc --- /dev/null +++ b/doc/git-cm/alias.txt @@ -0,0 +1 @@ +commit --message diff --git a/doc/git-cm/description.md b/doc/git-cm/description.md new file mode 100644 index 0000000..dc62a0e --- /dev/null +++ b/doc/git-cm/description.md @@ -0,0 +1,7 @@ +Commit with a message. + +Example: + +```shell +git cm +``` diff --git a/doc/git-cm/git-cm.gitconfig b/doc/git-cm/git-cm.gitconfig new file mode 100644 index 0000000..41a29b9 --- /dev/null +++ b/doc/git-cm/git-cm.gitconfig @@ -0,0 +1,2 @@ +[alias] + cm = "commit --message" diff --git a/doc/git-co/alias.txt b/doc/git-co/alias.txt new file mode 100644 index 0000000..72c48c6 --- /dev/null +++ b/doc/git-co/alias.txt @@ -0,0 +1 @@ +checkout diff --git a/doc/git-co/description.md b/doc/git-co/description.md new file mode 100644 index 0000000..6f1dde3 --- /dev/null +++ b/doc/git-co/description.md @@ -0,0 +1,7 @@ +Checkout, i.e. update the working tree to match a branch or paths. + +Example: + +```shell +git co +``` diff --git a/doc/git-co/git-co.gitconfig b/doc/git-co/git-co.gitconfig new file mode 100644 index 0000000..af2b576 --- /dev/null +++ b/doc/git-co/git-co.gitconfig @@ -0,0 +1,2 @@ +[alias] + co = "checkout" diff --git a/doc/git-cob/alias.txt b/doc/git-cob/alias.txt new file mode 100644 index 0000000..3dee3c9 --- /dev/null +++ b/doc/git-cob/alias.txt @@ -0,0 +1 @@ +checkout -b diff --git a/doc/git-cob/description.md b/doc/git-cob/description.md new file mode 100644 index 0000000..773a277 --- /dev/null +++ b/doc/git-cob/description.md @@ -0,0 +1,7 @@ +Create a new branch from the current working tree, and switch to it. + +Example: + +```shell +git cob new-branch +``` diff --git a/doc/git-cob/git-cob.gitconfig b/doc/git-cob/git-cob.gitconfig new file mode 100644 index 0000000..1bbc353 --- /dev/null +++ b/doc/git-cob/git-cob.gitconfig @@ -0,0 +1,2 @@ +[alias] + cob = "checkout -b" diff --git a/doc/git-cog/description.md b/doc/git-cog/description.md new file mode 100644 index 0000000..e8f2d3f --- /dev/null +++ b/doc/git-cog/description.md @@ -0,0 +1,7 @@ +Checkout with guessing. + +Example: + +```shell +git cog +``` diff --git a/doc/git-commit-is-merge/alias.sh b/doc/git-commit-is-merge/alias.sh new file mode 100644 index 0000000..5821c2a --- /dev/null +++ b/doc/git-commit-is-merge/alias.sh @@ -0,0 +1 @@ +f(){ [ -n "$(git commit-parents "$*" | sed '0,/^parent /d')" ];};f diff --git a/doc/git-commit-is-merge/description.md b/doc/git-commit-is-merge/description.md new file mode 100644 index 0000000..243cf13 --- /dev/null +++ b/doc/git-commit-is-merge/description.md @@ -0,0 +1,7 @@ +Is the commit a merge commit? If yes exit 0, else exit 1. + +Example: + +```shell +git commit-is-merge && do-something || do-something-else +``` diff --git a/doc/git-commit-message-key-lines/alias.sh b/doc/git-commit-message-key-lines/alias.sh new file mode 100644 index 0000000..18366d7 --- /dev/null +++ b/doc/git-commit-message-key-lines/alias.sh @@ -0,0 +1 @@ +f(){ echo "Commit: $1"; git log "$1" --format=fuller | grep "^[[:blank:]]*[[:alnum:]][-[:alnum:]]*:" | sed "s/^[[:blank:]]*//; s/:[[:blank:]]*/: /"; }; f diff --git a/doc/git-commit-message-key-lines/description.md b/doc/git-commit-message-key-lines/description.md new file mode 100644 index 0000000..31b5f0d --- /dev/null +++ b/doc/git-commit-message-key-lines/description.md @@ -0,0 +1,56 @@ +Show the commit's keyword-marker lines. + +Example: + +```shell +git commit-message-key-lines ce505d161fccdbc8d4bf12047846de7433ad6d04 +``` + +Show each line in the commit message that starts with optional +whitespace, then a keyword (i.e. alphanum and dash characters), +then a colon. The purpose is to help with analytics and reports. + +Example commit and message: + +```shell +commit ce505d161fccdbc8d4bf12047846de7433ad6d04 +Author: Alice Adams +Date: Tue May 28 11:53:47 2019 -0700 + + Add feature foo + + This commit does some good things. + + Time: 8 hours + Cost: 800 USD +``` + +Example command: + +```shell +git commit-message-key-lines ce505d161fccdbc8d4bf12047846de7433ad6d04 +``` + +Example output: + +```shell +Commit: ce505d161fccdbc8d4bf12047846de7433ad6d04 +Author: Alice Adams +Date: Tue May 28 11:53:47 2019 -0700 +Time: 8 hours +Cost: 800 USD + +The alias intentionally normalizes the output: + + * Start the output with "Commit: " so we know which commit. + + * Omit leading blanks i.e. print flush left. + + * After the colon, use one space, not a tab, or multiple spaces, etc. + +Known issues: + + * TODO: improve the keyword matcher so it requires the keyword to end + in an alphanum (not a dash), and also so the dash is a separator i.e. + the matcher does not accept a dash followed by another dash. + diff --git a/doc/git-commit-parents/alias.sh b/doc/git-commit-parents/alias.sh new file mode 100644 index 0000000..8a9a7fb --- /dev/null +++ b/doc/git-commit-parents/alias.sh @@ -0,0 +1 @@ +f(){ git cat-file -p "${*:-HEAD}" | sed -n '/0/,/^ *$/{/^parent /p}'; };f diff --git a/doc/git-commit-parents/description.md b/doc/git-commit-parents/description.md new file mode 100644 index 0000000..dde43fc --- /dev/null +++ b/doc/git-commit-parents/description.md @@ -0,0 +1,7 @@ +Show the commit's parents. + +Example: + +```shell +git commit-parents +``` diff --git a/doc/git-cong/alias.txt b/doc/git-cong/alias.txt new file mode 100644 index 0000000..5209a4e --- /dev/null +++ b/doc/git-cong/alias.txt @@ -0,0 +1 @@ +checkout --no-guess diff --git a/doc/git-cong/description.md b/doc/git-cong/description.md new file mode 100644 index 0000000..edeffaa --- /dev/null +++ b/doc/git-cong/description.md @@ -0,0 +1,7 @@ +Checkout with no guessing. + +Example: + +```shell +git cong +``` diff --git a/doc/git-cong/git-cong.gitconfig b/doc/git-cong/git-cong.gitconfig new file mode 100644 index 0000000..5732ad7 --- /dev/null +++ b/doc/git-cong/git-cong.gitconfig @@ -0,0 +1,2 @@ +[alias] + cong = "checkout --no-guess" diff --git a/doc/git-count/description.md b/doc/git-count/description.md new file mode 100644 index 0000000..e69de29 diff --git a/doc/git-cp/alias.txt b/doc/git-cp/alias.txt new file mode 100644 index 0000000..24ca8d6 --- /dev/null +++ b/doc/git-cp/alias.txt @@ -0,0 +1 @@ +cherry-pick diff --git a/doc/git-cp/description.md b/doc/git-cp/description.md new file mode 100644 index 0000000..6172963 --- /dev/null +++ b/doc/git-cp/description.md @@ -0,0 +1,9 @@ +Cherry-pick, i.e. apply the changes introduced by some existing commits. + +Example: + +```shell +git cp +``` + +Cherry pick is useful for moving small chunks of code between branches. diff --git a/doc/git-cp/git-cp.gitconfig b/doc/git-cp/git-cp.gitconfig new file mode 100644 index 0000000..051aa39 --- /dev/null +++ b/doc/git-cp/git-cp.gitconfig @@ -0,0 +1,2 @@ +[alias] + cp = "cherry-pick" diff --git a/doc/git-cpa/alias.txt b/doc/git-cpa/alias.txt new file mode 100644 index 0000000..4b7f24f --- /dev/null +++ b/doc/git-cpa/alias.txt @@ -0,0 +1 @@ +cherry-pick --abort diff --git a/doc/git-cpa/description.md b/doc/git-cpa/description.md new file mode 100644 index 0000000..df8e9ab --- /dev/null +++ b/doc/git-cpa/description.md @@ -0,0 +1,7 @@ +Abort the cherry-pick process. + +Example: + +```shell +git cpa +``` diff --git a/doc/git-cpa/git-cpa.gitconfig b/doc/git-cpa/git-cpa.gitconfig new file mode 100644 index 0000000..e65119e --- /dev/null +++ b/doc/git-cpa/git-cpa.gitconfig @@ -0,0 +1,2 @@ +[alias] + cpa = "cherry-pick --abort" diff --git a/doc/git-cpc/alias.txt b/doc/git-cpc/alias.txt new file mode 100644 index 0000000..b004ff1 --- /dev/null +++ b/doc/git-cpc/alias.txt @@ -0,0 +1 @@ +cherry-pick --continue diff --git a/doc/git-cpc/description.md b/doc/git-cpc/description.md new file mode 100644 index 0000000..57f7252 --- /dev/null +++ b/doc/git-cpc/description.md @@ -0,0 +1,7 @@ +Continue the cherry-pick process. + +Example: + +```shell +git cpc +``` diff --git a/doc/git-cpc/git-cpc.gitconfig b/doc/git-cpc/git-cpc.gitconfig new file mode 100644 index 0000000..8cc52e3 --- /dev/null +++ b/doc/git-cpc/git-cpc.gitconfig @@ -0,0 +1,2 @@ +[alias] + cpc = "cherry-pick --continue" diff --git a/doc/git-cpn/alias.txt b/doc/git-cpn/alias.txt new file mode 100644 index 0000000..7c490cd --- /dev/null +++ b/doc/git-cpn/alias.txt @@ -0,0 +1 @@ +cherry-pick -n diff --git a/doc/git-cpn/description.md b/doc/git-cpn/description.md new file mode 100644 index 0000000..03bae18 --- /dev/null +++ b/doc/git-cpn/description.md @@ -0,0 +1,7 @@ +Cherry-pick with no commit. + +Example: + +```shell +git cpn +``` diff --git a/doc/git-cpn/git-cpn.gitconfig b/doc/git-cpn/git-cpn.gitconfig new file mode 100644 index 0000000..2dcb0f8 --- /dev/null +++ b/doc/git-cpn/git-cpn.gitconfig @@ -0,0 +1,2 @@ +[alias] + cpn = "cherry-pick -n" diff --git a/doc/git-cpnx/alias.txt b/doc/git-cpnx/alias.txt new file mode 100644 index 0000000..9397517 --- /dev/null +++ b/doc/git-cpnx/alias.txt @@ -0,0 +1 @@ +cherry-pick -n -x diff --git a/doc/git-cpnx/description.md b/doc/git-cpnx/description.md new file mode 100644 index 0000000..50b939e --- /dev/null +++ b/doc/git-cpnx/description.md @@ -0,0 +1,12 @@ +Cherry-pick with no commit and with explanation. + +Example: + +```shell +git cpnx +``` + +Cherry-pick with without making a commit. + +When when recording the commit, append a line +that says "(cherry picked from commit ...)" diff --git a/doc/git-cpnx/git-cpnx.gitconfig b/doc/git-cpnx/git-cpnx.gitconfig new file mode 100644 index 0000000..e1086da --- /dev/null +++ b/doc/git-cpnx/git-cpnx.gitconfig @@ -0,0 +1,2 @@ +[alias] + cpnx = "cherry-pick -n -x" diff --git a/doc/git-current-branch/alias.txt b/doc/git-current-branch/alias.txt new file mode 100644 index 0000000..65bb5e0 --- /dev/null +++ b/doc/git-current-branch/alias.txt @@ -0,0 +1 @@ +rev-parse --abbrev-ref HEAD diff --git a/doc/git-current-branch/description.md b/doc/git-current-branch/description.md new file mode 100644 index 0000000..986d256 --- /dev/null +++ b/doc/git-current-branch/description.md @@ -0,0 +1,16 @@ +Get the branch name of the current branch. + +Example: + +```shell +git current-branch +main +``` + +Git 2.22.0+ has the equivalent command: + +```shell +git branch --show-current +``` + +Note: Git Alias has many aliases that get the branch name of the current branch. A project goal is to ensure these aliases work on older git versions. Therefore these aliases use `git current-branch` instead of `git branch --show-current`. If the two implementations ever differ, then the git built-in is correct, and Git Alias must be fixed. diff --git a/doc/git-current-branch/git-current-branch.gitconfig b/doc/git-current-branch/git-current-branch.gitconfig new file mode 100644 index 0000000..5158bed --- /dev/null +++ b/doc/git-current-branch/git-current-branch.gitconfig @@ -0,0 +1,2 @@ +[alias] + current-branch = "rev-parse --abbrev-ref HEAD" diff --git a/doc/git-cvs-e/alias.txt b/doc/git-cvs-e/alias.txt new file mode 100644 index 0000000..27c5928 --- /dev/null +++ b/doc/git-cvs-e/alias.txt @@ -0,0 +1 @@ +cvsexportcommit -u -p diff --git a/doc/git-cvs-e/description.md b/doc/git-cvs-e/description.md new file mode 100644 index 0000000..6e4a833 --- /dev/null +++ b/doc/git-cvs-e/description.md @@ -0,0 +1,7 @@ +CVS Export. + +Example: + +```shell +git cvs-e +``` diff --git a/doc/git-cvs-e/git-cvs-e.gitconfig b/doc/git-cvs-e/git-cvs-e.gitconfig new file mode 100644 index 0000000..0d43d12 --- /dev/null +++ b/doc/git-cvs-e/git-cvs-e.gitconfig @@ -0,0 +1,2 @@ +[alias] + cvs-e = "cvsexportcommit -u -p" diff --git a/doc/git-cvs-i/alias.txt b/doc/git-cvs-i/alias.txt new file mode 100644 index 0000000..8c63c76 --- /dev/null +++ b/doc/git-cvs-i/alias.txt @@ -0,0 +1 @@ +cvsimport -k -a diff --git a/doc/git-cvs-i/description.md b/doc/git-cvs-i/description.md new file mode 100644 index 0000000..295fd12 --- /dev/null +++ b/doc/git-cvs-i/description.md @@ -0,0 +1,7 @@ +CVS Import. + +Example: + +```shell +git cvs-i +``` diff --git a/doc/git-cvs-i/git-cvs-i.gitconfig b/doc/git-cvs-i/git-cvs-i.gitconfig new file mode 100644 index 0000000..ca2429d --- /dev/null +++ b/doc/git-cvs-i/git-cvs-i.gitconfig @@ -0,0 +1,2 @@ +[alias] + cvs-i = "cvsimport -k -a" diff --git a/doc/git-cvs/description.md b/doc/git-cvs/description.md new file mode 100644 index 0000000..84f88fb --- /dev/null +++ b/doc/git-cvs/description.md @@ -0,0 +1,17 @@ +# git cvs-* + +## Aliases for working with CVS version control + +Git alias: + +```git +cvs-i = cvsimport -k -a +cvs-e = cvsexportcommit -u -p +``` + +Example: + +```shell +git cvs-i +git cvs-e +``` diff --git a/doc/git-d/alias.txt b/doc/git-d/alias.txt new file mode 100644 index 0000000..e779424 --- /dev/null +++ b/doc/git-d/alias.txt @@ -0,0 +1 @@ +diff diff --git a/doc/git-d/description.md b/doc/git-d/description.md new file mode 100644 index 0000000..01f8005 --- /dev/null +++ b/doc/git-d/description.md @@ -0,0 +1,7 @@ +Short for `git diff`. + +Example: + +```shell +git d +``` diff --git a/doc/git-d/git-d.gitconfig b/doc/git-d/git-d.gitconfig new file mode 100644 index 0000000..2f3edb3 --- /dev/null +++ b/doc/git-d/git-d.gitconfig @@ -0,0 +1,2 @@ +[alias] + d = "diff" diff --git a/doc/git-dc/alias.txt b/doc/git-dc/alias.txt new file mode 100644 index 0000000..8531918 --- /dev/null +++ b/doc/git-dc/alias.txt @@ -0,0 +1 @@ +diff --cached diff --git a/doc/git-dc/description.md b/doc/git-dc/description.md new file mode 100644 index 0000000..ccb7942 --- /dev/null +++ b/doc/git-dc/description.md @@ -0,0 +1,7 @@ +Diff in order to show changes not yet staged. + +Example: + +```shell +git dc +``` diff --git a/doc/git-dc/git-dc.gitconfig b/doc/git-dc/git-dc.gitconfig new file mode 100644 index 0000000..7886b1a --- /dev/null +++ b/doc/git-dc/git-dc.gitconfig @@ -0,0 +1,2 @@ +[alias] + dc = "diff --cached" diff --git a/doc/git-dd/alias.txt b/doc/git-dd/alias.txt new file mode 100644 index 0000000..4575288 --- /dev/null +++ b/doc/git-dd/alias.txt @@ -0,0 +1 @@ +diff-deep diff --git a/doc/git-dd/description.md b/doc/git-dd/description.md new file mode 100644 index 0000000..5f8066e --- /dev/null +++ b/doc/git-dd/description.md @@ -0,0 +1,9 @@ +Diff deep - show changes with our preferred options. + +Example: + +```shell +git dd +``` + +Also aliased as `diff-deep`. diff --git a/doc/git-dd/git-dd.gitconfig b/doc/git-dd/git-dd.gitconfig new file mode 100644 index 0000000..d0cb6bb --- /dev/null +++ b/doc/git-dd/git-dd.gitconfig @@ -0,0 +1,2 @@ +[alias] + dd = "diff-deep" diff --git a/doc/git-debug/alias.sh b/doc/git-debug/alias.sh new file mode 100644 index 0000000..4f1f89f --- /dev/null +++ b/doc/git-debug/alias.sh @@ -0,0 +1 @@ +GIT_PAGER='' gdb --args git diff --git a/doc/git-debug/description.md b/doc/git-debug/description.md new file mode 100644 index 0000000..f90442a --- /dev/null +++ b/doc/git-debug/description.md @@ -0,0 +1,14 @@ +Help debugging builtins. + +Example: + +```shell +git debug +``` + +When debugging builtins, we like to use `gdb` to analyze the runtime state. + +However, we have to disable the pager, and often we have to call +the program with arguments. + +If the program to debug is a builtin, then we use this alias. diff --git a/doc/git-default-branch/alias.txt b/doc/git-default-branch/alias.txt new file mode 100644 index 0000000..196d68d --- /dev/null +++ b/doc/git-default-branch/alias.txt @@ -0,0 +1 @@ +config init.defaultBranch diff --git a/doc/git-default-branch/description.md b/doc/git-default-branch/description.md new file mode 100644 index 0000000..816939c --- /dev/null +++ b/doc/git-default-branch/description.md @@ -0,0 +1,8 @@ +Get the default branch name. + +Example: + +```shell +git default-branch +main +``` diff --git a/doc/git-default-branch/git-default-branch.gitconfig b/doc/git-default-branch/git-default-branch.gitconfig new file mode 100644 index 0000000..b343ce7 --- /dev/null +++ b/doc/git-default-branch/git-default-branch.gitconfig @@ -0,0 +1,2 @@ +[alias] + default-branch = "config init.defaultBranch" diff --git a/doc/git-diff-all/alias.sh b/doc/git-diff-all/alias.sh new file mode 100644 index 0000000..d9f027f --- /dev/null +++ b/doc/git-diff-all/alias.sh @@ -0,0 +1 @@ +for name in $(git diff --name-only "$1"); do git difftool "$1" "$name" & done diff --git a/doc/git-diff-all/description.md b/doc/git-diff-all/description.md new file mode 100644 index 0000000..c8c6bec --- /dev/null +++ b/doc/git-diff-all/description.md @@ -0,0 +1,7 @@ +For each diff, call difftool. + +Example: + +```shell +git diff-all +``` diff --git a/doc/git-diff-changes/alias.txt b/doc/git-diff-changes/alias.txt new file mode 100644 index 0000000..b39e596 --- /dev/null +++ b/doc/git-diff-changes/alias.txt @@ -0,0 +1 @@ +diff --name-status -r diff --git a/doc/git-diff-changes/description.md b/doc/git-diff-changes/description.md new file mode 100644 index 0000000..9eac83c --- /dev/null +++ b/doc/git-diff-changes/description.md @@ -0,0 +1,7 @@ +Show diff of changes. + +Example: + +```shell +git diff-changes +``` diff --git a/doc/git-diff-changes/git-diff-changes.gitconfig b/doc/git-diff-changes/git-diff-changes.gitconfig new file mode 100644 index 0000000..b84d406 --- /dev/null +++ b/doc/git-diff-changes/git-diff-changes.gitconfig @@ -0,0 +1,2 @@ +[alias] + diff-changes = "diff --name-status -r" diff --git a/doc/git-diff-chunk/alias.sh b/doc/git-diff-chunk/alias.sh new file mode 100644 index 0000000..067911e --- /dev/null +++ b/doc/git-diff-chunk/alias.sh @@ -0,0 +1 @@ +f() { git show "$1:$3" | sed -n "/^[^ ].*$4(/,/^}/p" > .tmp1 ; git show "$2:$3" | sed -n "/^[^ ].*$4(/,/^}/p" > .tmp2 ; git diff --no-index .tmp1 .tmp2 ; }; f diff --git a/doc/git-diff-chunk/description.md b/doc/git-diff-chunk/description.md new file mode 100644 index 0000000..a60b5ad --- /dev/null +++ b/doc/git-diff-chunk/description.md @@ -0,0 +1,19 @@ +Show the diff of one chunk. + +Example: + +```shell +git diff-chunk +``` + +Suppose we want to see just the differences of one chunk, +such as one function, in one file, in two different commits. + +This alias creates two temp files which contain only the chunk, +then does a typical git diff. + +Syntax: + +```shell +git funcdiff +``` diff --git a/doc/git-diff-deep/alias.txt b/doc/git-diff-deep/alias.txt new file mode 100644 index 0000000..311d083 --- /dev/null +++ b/doc/git-diff-deep/alias.txt @@ -0,0 +1 @@ +diff --check --dirstat --find-copies --find-renames --histogram --color diff --git a/doc/git-diff-deep/description.md b/doc/git-diff-deep/description.md new file mode 100644 index 0000000..c5b98df --- /dev/null +++ b/doc/git-diff-deep/description.md @@ -0,0 +1,7 @@ +Diff with deep information using our preferred options, a.k.a. `dd`. + +Example: + +```shell +git diff-deep +``` diff --git a/doc/git-diff-deep/git-diff-deep.gitconfig b/doc/git-diff-deep/git-diff-deep.gitconfig new file mode 100644 index 0000000..43a8994 --- /dev/null +++ b/doc/git-diff-deep/git-diff-deep.gitconfig @@ -0,0 +1,2 @@ +[alias] + diff-deep = "diff --check --dirstat --find-copies --find-renames --histogram --color" diff --git a/doc/git-diff-staged/alias.txt b/doc/git-diff-staged/alias.txt new file mode 100644 index 0000000..8531918 --- /dev/null +++ b/doc/git-diff-staged/alias.txt @@ -0,0 +1 @@ +diff --cached diff --git a/doc/git-diff-staged/description.md b/doc/git-diff-staged/description.md new file mode 100644 index 0000000..f5a7caa --- /dev/null +++ b/doc/git-diff-staged/description.md @@ -0,0 +1,7 @@ +Show diffs that are cached i.e. staged. + +Example: + +```shell +git diff-staged +``` diff --git a/doc/git-diff-staged/git-diff-staged.gitconfig b/doc/git-diff-staged/git-diff-staged.gitconfig new file mode 100644 index 0000000..ea07218 --- /dev/null +++ b/doc/git-diff-staged/git-diff-staged.gitconfig @@ -0,0 +1,2 @@ +[alias] + diff-staged = "diff --cached" diff --git a/doc/git-diff-stat/alias.txt b/doc/git-diff-stat/alias.txt new file mode 100644 index 0000000..619ba14 --- /dev/null +++ b/doc/git-diff-stat/alias.txt @@ -0,0 +1 @@ +diff --stat --ignore-space-change -r diff --git a/doc/git-diff-stat/description.md b/doc/git-diff-stat/description.md new file mode 100644 index 0000000..1c4df5b --- /dev/null +++ b/doc/git-diff-stat/description.md @@ -0,0 +1,7 @@ +Diff with stat. + +Example: + +```shell +git diff-stat +``` diff --git a/doc/git-diff-stat/git-diff-stat.gitconfig b/doc/git-diff-stat/git-diff-stat.gitconfig new file mode 100644 index 0000000..301ccf5 --- /dev/null +++ b/doc/git-diff-stat/git-diff-stat.gitconfig @@ -0,0 +1,2 @@ +[alias] + diff-stat = "diff --stat --ignore-space-change -r" diff --git a/doc/git-diff/description.md b/doc/git-diff/description.md new file mode 100644 index 0000000..e9e17e2 --- /dev/null +++ b/doc/git-diff/description.md @@ -0,0 +1,24 @@ +# git diff-* + +## Show diff in various ways + +Git alias: + +```git +diff-all = !"for name in $(git diff --name-only $1); do git difftool $1 $name & done" +diff-changes = diff --name-status -r +diff-stat = diff --stat --ignore-space-change -r +diff-staged = diff --cached + +# Diff using our preferred options. A.k.a. `dd`. +diff-deep = diff --check --dirstat --find-copies --find-renames --histogram --color +``` + +Example: + +```shell +git diff-all +git diff-changes +git diff-stat +git diff-deep +``` diff --git a/doc/git-discard/alias.txt b/doc/git-discard/alias.txt new file mode 100644 index 0000000..f8b34e7 --- /dev/null +++ b/doc/git-discard/alias.txt @@ -0,0 +1 @@ +checkout -- diff --git a/doc/git-discard/description.md b/doc/git-discard/description.md new file mode 100644 index 0000000..7a2431c --- /dev/null +++ b/doc/git-discard/description.md @@ -0,0 +1,7 @@ +Discard changes in a file (or a list of files) in working tree. + +Example: + +```shell +git discard foo goo hoo +``` diff --git a/doc/git-discard/git-discard.gitconfig b/doc/git-discard/git-discard.gitconfig new file mode 100644 index 0000000..cdf2aa2 --- /dev/null +++ b/doc/git-discard/git-discard.gitconfig @@ -0,0 +1,2 @@ +[alias] + discard = "checkout --" diff --git a/doc/git-ds/alias.txt b/doc/git-ds/alias.txt new file mode 100644 index 0000000..258ba16 --- /dev/null +++ b/doc/git-ds/alias.txt @@ -0,0 +1 @@ +diff --staged diff --git a/doc/git-ds/description.md b/doc/git-ds/description.md new file mode 100644 index 0000000..3a0d64d --- /dev/null +++ b/doc/git-ds/description.md @@ -0,0 +1,7 @@ +Show changes about to be commited. + +Example: + +```shell +git ds +``` diff --git a/doc/git-ds/git-ds.gitconfig b/doc/git-ds/git-ds.gitconfig new file mode 100644 index 0000000..76379c2 --- /dev/null +++ b/doc/git-ds/git-ds.gitconfig @@ -0,0 +1,2 @@ +[alias] + ds = "diff --staged" diff --git a/doc/git-dw/alias.txt b/doc/git-dw/alias.txt new file mode 100644 index 0000000..7f4e695 --- /dev/null +++ b/doc/git-dw/alias.txt @@ -0,0 +1 @@ +diff --word-diff diff --git a/doc/git-dw/description.md b/doc/git-dw/description.md new file mode 100644 index 0000000..4e81dc6 --- /dev/null +++ b/doc/git-dw/description.md @@ -0,0 +1,7 @@ +Show changes by word, not line. + +Example: + +```shell +git dw +``` diff --git a/doc/git-dw/git-dw.gitconfig b/doc/git-dw/git-dw.gitconfig new file mode 100644 index 0000000..02feea7 --- /dev/null +++ b/doc/git-dw/git-dw.gitconfig @@ -0,0 +1,2 @@ +[alias] + dw = "diff --word-diff" diff --git a/doc/git-dwd/description.md b/doc/git-dwd/description.md new file mode 100644 index 0000000..fb00ab3 --- /dev/null +++ b/doc/git-dwd/description.md @@ -0,0 +1,7 @@ +Show changes by word, not by line. + +Example: + +```shell +git dwd +``` diff --git a/doc/git-edit-cached/alias.sh b/doc/git-edit-cached/alias.sh new file mode 100644 index 0000000..d2d4c21 --- /dev/null +++ b/doc/git-edit-cached/alias.sh @@ -0,0 +1 @@ +$(git var GIT_EDITOR) "$(git ls-files --cached | sort -u)" diff --git a/doc/git-edit-cached/description.md b/doc/git-edit-cached/description.md new file mode 100644 index 0000000..2ae0a03 --- /dev/null +++ b/doc/git-edit-cached/description.md @@ -0,0 +1,29 @@ +Edit cached files. + +Example: + +```shell +git edit-cached +``` + +Compare: + +* [git edit-cached](../git-edit-cached) (this alias) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) + +Compare corresponding aliases for add-*: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) diff --git a/doc/git-edit-deleted/alias.sh b/doc/git-edit-deleted/alias.sh new file mode 100644 index 0000000..b75c56b --- /dev/null +++ b/doc/git-edit-deleted/alias.sh @@ -0,0 +1 @@ +$(git var GIT_EDITOR) "$(git ls-files --deleted | sort -u)" diff --git a/doc/git-edit-deleted/description.md b/doc/git-edit-deleted/description.md new file mode 100644 index 0000000..c17adcb --- /dev/null +++ b/doc/git-edit-deleted/description.md @@ -0,0 +1,29 @@ +Edit deleted files. + +Example: + +```shell +git edit-cached +``` + +Compare: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) (this alias) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) + +Compare corresponding aliases for add-*: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) diff --git a/doc/git-edit-ignored/alias.sh b/doc/git-edit-ignored/alias.sh new file mode 100644 index 0000000..93e395d --- /dev/null +++ b/doc/git-edit-ignored/alias.sh @@ -0,0 +1 @@ +$(git var GIT_EDITOR) "$(git ls-files --ignored | sort -u)" diff --git a/doc/git-edit-ignored/description.md b/doc/git-edit-ignored/description.md new file mode 100644 index 0000000..09c8a7b --- /dev/null +++ b/doc/git-edit-ignored/description.md @@ -0,0 +1,29 @@ +Edit ignored files. + +Example: + +```shell +git edit-ignored +``` + +Compare: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) (this alias) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) + +Compare corresponding aliases for add-*: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) diff --git a/doc/git-edit-killed/alias.sh b/doc/git-edit-killed/alias.sh new file mode 100644 index 0000000..38e92ad --- /dev/null +++ b/doc/git-edit-killed/alias.sh @@ -0,0 +1 @@ +$(git var GIT_EDITOR) "$(git ls-files --killed | sort -u)" diff --git a/doc/git-edit-killed/description.md b/doc/git-edit-killed/description.md new file mode 100644 index 0000000..b3b8e10 --- /dev/null +++ b/doc/git-edit-killed/description.md @@ -0,0 +1,29 @@ +Edit killed files. + +Example: + +```shell +git edit-killed +``` + +Compare: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) (this alias) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) + +Compare corresponding aliases for add-*: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) diff --git a/doc/git-edit-modified/alias.sh b/doc/git-edit-modified/alias.sh new file mode 100644 index 0000000..9901395 --- /dev/null +++ b/doc/git-edit-modified/alias.sh @@ -0,0 +1 @@ +$(git var GIT_EDITOR) "$(git ls-files --modified | sort -u)" diff --git a/doc/git-edit-modified/description.md b/doc/git-edit-modified/description.md new file mode 100644 index 0000000..e7185a9 --- /dev/null +++ b/doc/git-edit-modified/description.md @@ -0,0 +1,29 @@ +Edit modified files. + +Example: + +```shell +git edit-modified +``` + +Compare: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) (this alias) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) + +Compare corresponding aliases for add-*: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) diff --git a/doc/git-edit-others/alias.sh b/doc/git-edit-others/alias.sh new file mode 100644 index 0000000..1b15635 --- /dev/null +++ b/doc/git-edit-others/alias.sh @@ -0,0 +1 @@ +$(git var GIT_EDITOR) "$(git ls-files --others | sort -u)" diff --git a/doc/git-edit-others/description.md b/doc/git-edit-others/description.md new file mode 100644 index 0000000..da695a8 --- /dev/null +++ b/doc/git-edit-others/description.md @@ -0,0 +1,27 @@ +Edit other files. + +```shell +git edit-cached +``` + +Compare: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) (this alias) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) + +Compare corresponding aliases for add-*: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) diff --git a/doc/git-edit-stage/alias.sh b/doc/git-edit-stage/alias.sh new file mode 100644 index 0000000..1598b20 --- /dev/null +++ b/doc/git-edit-stage/alias.sh @@ -0,0 +1 @@ +$(git var GIT_EDITOR) "$(git ls-files --stage | cut -f2 | sort -u)" diff --git a/doc/git-edit-stage/description.md b/doc/git-edit-stage/description.md new file mode 100644 index 0000000..2d1f381 --- /dev/null +++ b/doc/git-edit-stage/description.md @@ -0,0 +1,29 @@ +Edit stage files. + +Example: + +```shell +git edit-stage +``` + +Compare: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) (this alias) +* [git edit-unmerged](../git-edit-unmerged) + +Compare corresponding aliases for add-*: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) diff --git a/doc/git-edit-unmerged/alias.sh b/doc/git-edit-unmerged/alias.sh new file mode 100644 index 0000000..2d044a4 --- /dev/null +++ b/doc/git-edit-unmerged/alias.sh @@ -0,0 +1 @@ +$(git var GIT_EDITOR) "$(git ls-files --unmerged | cut -f2 | sort -u)" diff --git a/doc/git-edit-unmerged/description.md b/doc/git-edit-unmerged/description.md new file mode 100644 index 0000000..84ee375 --- /dev/null +++ b/doc/git-edit-unmerged/description.md @@ -0,0 +1,29 @@ +Edit unmerged files. + +Example: + +```shell +git edit-cached +``` + +Compare: + +* [git edit-cached](../git-edit-cached) +* [git edit-deleted](../git-edit-deleted) +* [git edit-others](../git-edit-others) +* [git edit-ignored](../git-edit-ignored) +* [git edit-killed](../git-edit-killed) +* [git edit-modified](../git-edit-modified) +* [git edit-stage](../git-edit-stage) +* [git edit-unmerged](../git-edit-unmerged) (this alias) + +Compare corresponding aliases for add-*: + +* [git add-cached](../git-add-cached) +* [git add-deleted](../git-add-deleted) +* [git add-others](../git-add-others) +* [git add-ignored](../git-add-ignored) +* [git add-killed](../git-add-killed) +* [git add-modified](../git-add-modified) +* [git add-stage](../git-add-stage) +* [git add-unmerged](../git-add-unmerged) diff --git a/doc/git-edit/description.md b/doc/git-edit/description.md new file mode 100644 index 0000000..b30fc6d --- /dev/null +++ b/doc/git-edit/description.md @@ -0,0 +1,31 @@ +# git edit-* + +## Edit all files of a given type + +Git alias: + +```git +edit-cached = !"f() { git ls-files --cached | sort -u ; }; `git var GIT_EDITOR` `f`" +edit-deleted = !"f() { git ls-files --deleted | sort -u ; }; `git var GIT_EDITOR` `f`" +edit-others = !"f() { git ls-files --others | sort -u ; }; `git var GIT_EDITOR` `f`" +edit-ignored = !"f() { git ls-files --ignored | sort -u ; }; `git var GIT_EDITOR` `f`" +edit-killed = !"f() { git ls-files --killed | sort -u ; }; `git var GIT_EDITOR` `f`" +edit-modified = !"f() { git ls-files --modified | sort -u ; }; `git var GIT_EDITOR` `f`" +edit-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`" +edit-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +Example: + +```shell +git edit-cached +git edit-deleted +git edit-others +git edit-ignored +git edit-killed +git edit-modified +git edit-stage +git edit-unmerged +``` + +These aliases intentionally match the aliases [git add-*](../git-add). diff --git a/doc/git-exec/alias.sh b/doc/git-exec/alias.sh new file mode 100644 index 0000000..a6b944a --- /dev/null +++ b/doc/git-exec/alias.sh @@ -0,0 +1 @@ + exec diff --git a/doc/git-exec/description.md b/doc/git-exec/description.md new file mode 100644 index 0000000..196a889 --- /dev/null +++ b/doc/git-exec/description.md @@ -0,0 +1,10 @@ +Execute a shell script. + +Example: + +```shell +git exec pwd +/home/alice/projects/example +``` + +Note: git always runs scripts in the top directory. diff --git a/doc/git-expunge/alias.sh b/doc/git-expunge/alias.sh new file mode 100644 index 0000000..5ff5986 --- /dev/null +++ b/doc/git-expunge/alias.sh @@ -0,0 +1 @@ +f() { git filter-branch --force --index-filter "git rm --cached --ignore-unmatch $1" --prune-empty --tag-name-filter "cat" -- --all ; }; f diff --git a/doc/git-expunge/description.md b/doc/git-expunge/description.md new file mode 100644 index 0000000..984c8c9 --- /dev/null +++ b/doc/git-expunge/description.md @@ -0,0 +1,15 @@ +Delete a file everywhere. + +Example: + +```shell +git expunge file.txt +``` + +This command is typically for a serious problem, such as accidentally +committing a file of sensitive data, such as passwords or secrets or +confidential information. + +After you use this command, you will likely need to force push everything. + +See diff --git a/doc/git-f/alias.txt b/doc/git-f/alias.txt new file mode 100644 index 0000000..bad6ace --- /dev/null +++ b/doc/git-f/alias.txt @@ -0,0 +1 @@ +fetch diff --git a/doc/git-f/description.md b/doc/git-f/description.md new file mode 100644 index 0000000..0a79b83 --- /dev/null +++ b/doc/git-f/description.md @@ -0,0 +1,7 @@ +Short for "git fetch". + +Example: + +```shell +git f +``` diff --git a/doc/git-f/git-f.gitconfig b/doc/git-f/git-f.gitconfig new file mode 100644 index 0000000..ecbec02 --- /dev/null +++ b/doc/git-f/git-f.gitconfig @@ -0,0 +1,2 @@ +[alias] + f = "fetch" diff --git a/doc/git-fa/alias.txt b/doc/git-fa/alias.txt new file mode 100644 index 0000000..8bd0911 --- /dev/null +++ b/doc/git-fa/alias.txt @@ -0,0 +1 @@ +fetch --all diff --git a/doc/git-fa/description.md b/doc/git-fa/description.md new file mode 100644 index 0000000..0542658 --- /dev/null +++ b/doc/git-fa/description.md @@ -0,0 +1,7 @@ +Fetch all remotes. + +Example: + +```shell +git fa +``` diff --git a/doc/git-fa/git-fa.gitconfig b/doc/git-fa/git-fa.gitconfig new file mode 100644 index 0000000..46bc9ed --- /dev/null +++ b/doc/git-fa/git-fa.gitconfig @@ -0,0 +1,2 @@ +[alias] + fa = "fetch --all" diff --git a/doc/git-fav/alias.txt b/doc/git-fav/alias.txt new file mode 100644 index 0000000..5ae353d --- /dev/null +++ b/doc/git-fav/alias.txt @@ -0,0 +1 @@ +fetch --all --verbose diff --git a/doc/git-fav/description.md b/doc/git-fav/description.md new file mode 100644 index 0000000..9ba4253 --- /dev/null +++ b/doc/git-fav/description.md @@ -0,0 +1,7 @@ +Fetch all remotes, with verbose output. + +Example: + +```shell +git fav +``` diff --git a/doc/git-fav/git-fav.gitconfig b/doc/git-fav/git-fav.gitconfig new file mode 100644 index 0000000..dc47b39 --- /dev/null +++ b/doc/git-fav/git-fav.gitconfig @@ -0,0 +1,2 @@ +[alias] + fav = "fetch --all --verbose" diff --git a/doc/git-fixup/alias.sh b/doc/git-fixup/alias.sh new file mode 100644 index 0000000..7f70419 --- /dev/null +++ b/doc/git-fixup/alias.sh @@ -0,0 +1 @@ +f() { TARGET="$(git rev-parse "$1")"; git commit --fixup="$TARGET" && GIT_EDITOR=true git rebase --interactive --autosquash "$TARGET"~; }; f diff --git a/doc/git-fixup/description.md b/doc/git-fixup/description.md new file mode 100644 index 0000000..d4e479d --- /dev/null +++ b/doc/git-fixup/description.md @@ -0,0 +1,11 @@ +Fix a commit by amending it. + +Example: + +```shell +git fixup +``` + +See + +This alias is a slightly modified version. diff --git a/doc/git-g/alias.txt b/doc/git-g/alias.txt new file mode 100644 index 0000000..bdbac16 --- /dev/null +++ b/doc/git-g/alias.txt @@ -0,0 +1 @@ +grep diff --git a/doc/git-g/description.md b/doc/git-g/description.md new file mode 100644 index 0000000..437f092 --- /dev/null +++ b/doc/git-g/description.md @@ -0,0 +1,11 @@ +Short for "git grep". + +Example: + +```shell +git g +``` + +This will search for text. + +The term "grep" stands for "general regular expression parser". diff --git a/doc/git-g/git-g.gitconfig b/doc/git-g/git-g.gitconfig new file mode 100644 index 0000000..3b0737d --- /dev/null +++ b/doc/git-g/git-g.gitconfig @@ -0,0 +1,2 @@ +[alias] + g = "grep" diff --git a/doc/git-get-git-put/description.md b/doc/git-get-git-put/description.md new file mode 100644 index 0000000..bb3d66f --- /dev/null +++ b/doc/git-get-git-put/description.md @@ -0,0 +1,45 @@ +# git get & git put + +## Synchronize changes for the current branch + +Git alias: + +```git +get = !git fetch --prune && git pull --rebase && git submodule update --init --recursive +put = !git commit --all && git push +``` + +Example: + +```shell +git get +git put +``` + +Our workflow does these steps: + + * git get: fetch and prune, pull and rebase, then update submodules. + + * git put: commit all items, then push. + +If you want to preserve merges, then we recommend you set this: + +```shell +git config pull.rebase preserve +``` + +TODO: + + * Handle tags + + * Delete superfluous branches + + * Add error handing + +Compare: + +* [git get & git put](../git-get-git-put) (this page) + +* [git get](../git-get) + +* [git put](../git-put) diff --git a/doc/git-get/alias.sh b/doc/git-get/alias.sh new file mode 100644 index 0000000..d4a022d --- /dev/null +++ b/doc/git-get/alias.sh @@ -0,0 +1 @@ +git fetch --prune && git pull --rebase && git submodule update --init --recursive diff --git a/doc/git-get/description.md b/doc/git-get/description.md new file mode 100644 index 0000000..3a74b52 --- /dev/null +++ b/doc/git-get/description.md @@ -0,0 +1,15 @@ +Get all changes for the current branch. + +Example: + +```shell +git get +``` + +Compare: + +* [git get & git put](../git-get-git-put) (describes both) + +* [git get](../git-get) (this alias) + +* [git put](../git-put) diff --git a/doc/git-gg/alias.txt b/doc/git-gg/alias.txt new file mode 100644 index 0000000..9788d8d --- /dev/null +++ b/doc/git-gg/alias.txt @@ -0,0 +1 @@ +grep-group diff --git a/doc/git-gg/description.md b/doc/git-gg/description.md new file mode 100644 index 0000000..5c03c56 --- /dev/null +++ b/doc/git-gg/description.md @@ -0,0 +1,9 @@ +Grep group i.e. search with our preferred options. + +Example: + +```shell +git gg +``` + +Also aliased as [git grep-group](../git-grep-group). diff --git a/doc/git-gg/git-gg.gitconfig b/doc/git-gg/git-gg.gitconfig new file mode 100644 index 0000000..88fe4fb --- /dev/null +++ b/doc/git-gg/git-gg.gitconfig @@ -0,0 +1,2 @@ +[alias] + gg = "grep-group" diff --git a/doc/git-gitk-conflict/alias.sh b/doc/git-gitk-conflict/alias.sh new file mode 100644 index 0000000..0d00da1 --- /dev/null +++ b/doc/git-gitk-conflict/alias.sh @@ -0,0 +1 @@ +gitk --left-right HEAD...MERGE_HEAD diff --git a/doc/git-gitk-conflict/description.md b/doc/git-gitk-conflict/description.md new file mode 100644 index 0000000..97505f8 --- /dev/null +++ b/doc/git-gitk-conflict/description.md @@ -0,0 +1,7 @@ +Use gitk tool to show conflicting merge. + +Example: + +```shell +git gitk-conflict +``` diff --git a/doc/git-gitk-history-all/alias.sh b/doc/git-gitk-history-all/alias.sh new file mode 100644 index 0000000..b026602 --- /dev/null +++ b/doc/git-gitk-history-all/alias.sh @@ -0,0 +1 @@ +gitk --all "$(git fsck | awk '/dangling commit/ {print $3}')" diff --git a/doc/git-gitk-history-all/description.md b/doc/git-gitk-history-all/description.md new file mode 100644 index 0000000..358156f --- /dev/null +++ b/doc/git-gitk-history-all/description.md @@ -0,0 +1,9 @@ +Use gitk tool to show full history, including "deleted" branches and stashes. + +Example: + +```shell +git gitk-history-all +``` + +This will show full history, including "deleted" branches and stashes. diff --git a/doc/git-gitk/description.md b/doc/git-gitk/description.md new file mode 100644 index 0000000..1e67759 --- /dev/null +++ b/doc/git-gitk/description.md @@ -0,0 +1,6 @@ +# git gitk-* + +## Aliases related to the gitk tool + +* [git gitk-conflict](git-gitk-conflict) - Use gitk to show conflicting merge. +* [git gitk-history-all](git-gitk-history-all) - Use gitk to show full history. diff --git a/doc/git-gn/alias.txt b/doc/git-gn/alias.txt new file mode 100644 index 0000000..94f5ec9 --- /dev/null +++ b/doc/git-gn/alias.txt @@ -0,0 +1 @@ +grep -n diff --git a/doc/git-gn/description.md b/doc/git-gn/description.md new file mode 100644 index 0000000..25b427b --- /dev/null +++ b/doc/git-gn/description.md @@ -0,0 +1,9 @@ +Grep and show line number. + +Example: + +```shell +git gn +``` + +Same as `git grep --line-number`. diff --git a/doc/git-gn/git-gn.gitconfig b/doc/git-gn/git-gn.gitconfig new file mode 100644 index 0000000..aaf70b7 --- /dev/null +++ b/doc/git-gn/git-gn.gitconfig @@ -0,0 +1,2 @@ +[alias] + gn = "grep -n" diff --git a/doc/git-graphviz/alias.sh b/doc/git-graphviz/alias.sh new file mode 100644 index 0000000..4ed272a --- /dev/null +++ b/doc/git-graphviz/alias.sh @@ -0,0 +1 @@ +f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' "$@" | sed 's/[0-9a-f][0-9a-f]*/"&"/g' ; echo '}'; }; f diff --git a/doc/git-graphviz/description.md b/doc/git-graphviz/description.md new file mode 100644 index 0000000..a6eeb53 --- /dev/null +++ b/doc/git-graphviz/description.md @@ -0,0 +1,17 @@ +Use graphviz tool for display. + +Example: + +```shell +git graphviz +``` + +This produces output that can be displayed using dotty. + +Example: + +```shell +git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin + +git graphviz --first-parent main | dotty /dev/stdin +``` diff --git a/doc/git-grep-ack/alias.txt b/doc/git-grep-ack/alias.txt new file mode 100644 index 0000000..7a26b8e --- /dev/null +++ b/doc/git-grep-ack/alias.txt @@ -0,0 +1 @@ +-c color.grep.linenumber="bold yellow" -c color.grep.filename="bold green" -c color.grep.match="reverse yellow" grep --break --heading --line-number diff --git a/doc/git-grep-ack/description.md b/doc/git-grep-ack/description.md new file mode 100644 index 0000000..08889fe --- /dev/null +++ b/doc/git-grep-ack/description.md @@ -0,0 +1,7 @@ +Find text with ack-like formatting. + +Example: + +```shell +git grep-ack +``` diff --git a/doc/git-grep-ack/git-grep-ack.gitconfig b/doc/git-grep-ack/git-grep-ack.gitconfig new file mode 100644 index 0000000..29833f3 --- /dev/null +++ b/doc/git-grep-ack/git-grep-ack.gitconfig @@ -0,0 +1,2 @@ +[alias] + grep-ack = "-c color.grep.linenumber="bold yellow" -c color.grep.filename="bold green" -c color.grep.match="reverse yellow" grep --break --heading --line-number" diff --git a/doc/git-grep-all/alias.sh b/doc/git-grep-all/alias.sh new file mode 100644 index 0000000..a5a8aaf --- /dev/null +++ b/doc/git-grep-all/alias.sh @@ -0,0 +1 @@ +f() { git rev-list --all | xargs git grep "$@"; }; f diff --git a/doc/git-grep-all/description.md b/doc/git-grep-all/description.md new file mode 100644 index 0000000..8255598 --- /dev/null +++ b/doc/git-grep-all/description.md @@ -0,0 +1,13 @@ +Find text in any commit ever. + +Syntax: + +```shell +git grep-all … +``` + +Example: + +```shell +git grep-all foo +``` diff --git a/doc/git-grep-group/alias.txt b/doc/git-grep-group/alias.txt new file mode 100644 index 0000000..deac0c6 --- /dev/null +++ b/doc/git-grep-group/alias.txt @@ -0,0 +1 @@ +grep --break --heading --line-number --color diff --git a/doc/git-grep-group/description.md b/doc/git-grep-group/description.md new file mode 100644 index 0000000..e77437f --- /dev/null +++ b/doc/git-grep-group/description.md @@ -0,0 +1,13 @@ +Find text and group the output lines, a.k.a. `gg`. + +Syntax: + +```shell +git grep-group [options] +``` + +Example: + +```shell +git grep-group foo +``` diff --git a/doc/git-grep-group/git-grep-group.gitconfig b/doc/git-grep-group/git-grep-group.gitconfig new file mode 100644 index 0000000..32a190d --- /dev/null +++ b/doc/git-grep-group/git-grep-group.gitconfig @@ -0,0 +1,2 @@ +[alias] + grep-group = "grep --break --heading --line-number --color" diff --git a/doc/git-grep/description.md b/doc/git-grep/description.md new file mode 100644 index 0000000..48ff561 --- /dev/null +++ b/doc/git-grep/description.md @@ -0,0 +1,28 @@ +# git grep-* + +## Grep helpers + +Git alias: + +```git +# Find text in any commit ever. +grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f" + +# Find text and group the output lines. A.k.a. `gg`. +grep-group = grep --break --heading --line-number --color + +# Find text with ack-like formatting. +grep-ack = \ + -c color.grep.linenumber=\"bold yellow\" \ + -c color.grep.filename=\"bold green\" \ + -c color.grep.match=\"reverse yellow\" \ + grep --break --heading --line-number +``` + +Example: + +```shell +git grep-all +git grep-group +git grep-ack +``` diff --git a/doc/git-heads/alias.sh b/doc/git-heads/alias.sh new file mode 100644 index 0000000..1995844 --- /dev/null +++ b/doc/git-heads/alias.sh @@ -0,0 +1 @@ +git log origin/main.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';' diff --git a/doc/git-heads/description.md b/doc/git-heads/description.md new file mode 100644 index 0000000..a1621c8 --- /dev/null +++ b/doc/git-heads/description.md @@ -0,0 +1,9 @@ +Show log of heads. + +Example: + +```shell +git heads +``` + +Thanks to . diff --git a/doc/git-hew-dry-run/alias.sh b/doc/git-hew-dry-run/alias.sh new file mode 100644 index 0000000..8a411bb --- /dev/null +++ b/doc/git-hew-dry-run/alias.sh @@ -0,0 +1 @@ +git hew-local-dry-run "$@" && git hew-remote-dry-run "$@" # diff --git a/doc/git-hew-dry-run/description.md b/doc/git-hew-dry-run/description.md new file mode 100644 index 0000000..e64309d --- /dev/null +++ b/doc/git-hew-dry-run/description.md @@ -0,0 +1,34 @@ +Delete all branches that have been merged into a commit (dry run). + +Syntax: + +```shell +hew-dry-run [] +``` + +Example with default branch name: + +```shell +git hew-dry-run +``` + +Example with specific branch name: + +```shell +git hew-dry-run main +``` + +Example with specific commit hash: + +```shell +git hew-dry-run 4677ad893ee038b113e22f6330da6ae710712f88 +``` + +Compare these: + +* [git hew](../git-hew) +* [git hew-dry-run](../git-hew-dry-run) +* [git hew-local](../git-hew-local) +* [git hew-local-dry-run](../git-hew-local-dry-run) +* [git hew-remote](../git-hew-remote) +* [git hew-remote-dry-run](../git-hew-remote-dry-run) diff --git a/doc/git-hew-local-dry-run/alias.sh b/doc/git-hew-local-dry-run/alias.sh new file mode 100644 index 0000000..60618c0 --- /dev/null +++ b/doc/git-hew-local-dry-run/alias.sh @@ -0,0 +1 @@ +f() { commit=${1:-$(git current-branch)}; git branch --merged "$commit" | grep -v "^[[:space:]]*\*[[:space:]]*$commit$" ; }; f "$@" diff --git a/doc/git-hew-local-dry-run/description.md b/doc/git-hew-local-dry-run/description.md new file mode 100644 index 0000000..b0ca379 --- /dev/null +++ b/doc/git-hew-local-dry-run/description.md @@ -0,0 +1,38 @@ +Delete local branches that have been merged into a commit (dry run). + +Syntax: + +```shell +hew-local-dry-run [] +``` + +Example with the default branch name: + +```shell +git hew-local-dry-run +``` + +Example with a specific branch name: + +```shell +git hew-local-dry-run main +``` + +Example with a specific commmit hash: + +```shell +git hew-local-dry-run 4677ad893ee038b113e22f6330da6ae710712f88 +``` + +If a branch is provided, or commit is provided, then this alias will use it. + +Otherwise, this alias will use the current branch name. + +Compare these: + +* [git hew](../git-hew) +* [git hew-dry-run](../git-hew-dry-run) +* [git hew-local](../git-hew-local) +* [git hew-local-dry-run](../git-hew-local-dry-run) +* [git hew-remote](../git-hew-remote) +* [git hew-remote-dry-run](../git-hew-remote-dry-run) diff --git a/doc/git-hew-local/alias.sh b/doc/git-hew-local/alias.sh new file mode 100644 index 0000000..30fee6c --- /dev/null +++ b/doc/git-hew-local/alias.sh @@ -0,0 +1 @@ +f() { git hew-local-dry-run "$@" | xargs git branch --delete ; }; f "$@" diff --git a/doc/git-hew-local/description.md b/doc/git-hew-local/description.md new file mode 100644 index 0000000..6a9245f --- /dev/null +++ b/doc/git-hew-local/description.md @@ -0,0 +1,38 @@ +Delete local branches that have been merged into a commit. + +Syntax: + +```shell +git hew-local [] +``` + +Example with the default branch name: + +```shell +git hew-local +``` + +Example with a specific branch name: + +```shell +git hew-local main +``` + +Example with a specific commmit hash: + +```shell +git hew-local 4677ad893ee038b113e22f6330da6ae710712f88 +``` + +If a branch is provided, or commit is provided, then this alias will use it. + +Otherwise, this alias will use the current branch name. + +Compare these: + +* [git hew](../git-hew) +* [git hew-dry-run](../git-hew-dry-run) +* [git hew-local](../git-hew-local) +* [git hew-local-dry-run](../git-hew-local-dry-run) +* [git hew-remote](../git-hew-remote) +* [git hew-remote-dry-run](../git-hew-remote-dry-run) diff --git a/doc/git-hew-remote-dry-run/alias.sh b/doc/git-hew-remote-dry-run/alias.sh new file mode 100644 index 0000000..3e406db --- /dev/null +++ b/doc/git-hew-remote-dry-run/alias.sh @@ -0,0 +1 @@ +f() { commit=${1:-$(git upstream-branch)}; git branch --remotes --merged "$commit" | grep -v "^[[:space:]]*origin/$commit$" | sed 's#[[:space:]]*origin/##' ; }; f "$@" diff --git a/doc/git-hew-remote-dry-run/description.md b/doc/git-hew-remote-dry-run/description.md new file mode 100644 index 0000000..3653ffb --- /dev/null +++ b/doc/git-hew-remote-dry-run/description.md @@ -0,0 +1,38 @@ +Delete remote branches that have been merged into an upstream commit (dry run). + +Syntax: + +```shell +git hew-remote-dry-run [] +``` + +Example with the default upstream branch name: + +```shell +git hew-remote-dry-run +``` + +Example with a specific upstream branch name: + +```shell +git hew-remote-dry-run main +``` + +Example with a specific upstream commit hash: + +```shell +git hew-remote-dry-run 4677ad893ee038b113e22f6330da6ae710712f88 +``` + +If a branch is provided, or a commit is provided, then this alias will use it. + +Otherwise, this alias will use the upstream branch name. + +Compare these: + +* [git hew](../git-hew) +* [git hew-dry-run](../git-hew-dry-run) +* [git hew-local](../git-hew-local) +* [git hew-local-dry-run](../git-hew-local-dry-run) +* [git hew-remote](../git-hew-remote) +* [git hew-remote-dry-run](../git-hew-remote-dry-run) diff --git a/doc/git-hew-remote/alias.sh b/doc/git-hew-remote/alias.sh new file mode 100644 index 0000000..1e6b5e3 --- /dev/null +++ b/doc/git-hew-remote/alias.sh @@ -0,0 +1 @@ +f() { git hew-remote-dry-run "$@" | xargs -I% git push origin :% 2>&1 ; }; f "$@" diff --git a/doc/git-hew-remote/description.md b/doc/git-hew-remote/description.md new file mode 100644 index 0000000..4164f44 --- /dev/null +++ b/doc/git-hew-remote/description.md @@ -0,0 +1,38 @@ +Delete remote branches that have been merged into an upstream commit. + +Syntax: + +```shell +git hew-remote [] +``` + +Example with the default upstream branch name: + +```shell +git hew-remote +``` + +Example with a specific upstream branch name: + +```shell +git hew-remote main +``` + +Example with a specific upstream commit hash: + +```shell +git hew-remote 4677ad893ee038b113e22f6330da6ae710712f88 +``` + +If a branch is provided, or a commit is provided, then this alias will use it. + +Otherwise, this alias will use the upstream branch name. + +Compare these: + +* [git hew](../git-hew) +* [git hew-dry-run](../git-hew-dry-run) +* [git hew-local](../git-hew-local) +* [git hew-local-dry-run](../git-hew-local-dry-run) +* [git hew-remote](../git-hew-remote) +* [git hew-remote-dry-run](../git-hew-remote-dry-run) diff --git a/doc/git-hew/alias.sh b/doc/git-hew/alias.sh new file mode 100644 index 0000000..8bb70d6 --- /dev/null +++ b/doc/git-hew/alias.sh @@ -0,0 +1 @@ +git hew-local "$@" && git hew-remote "$@" # diff --git a/doc/git-hew/description.md b/doc/git-hew/description.md new file mode 100644 index 0000000..83a0ee8 --- /dev/null +++ b/doc/git-hew/description.md @@ -0,0 +1,34 @@ +Delete all branches that have been merged into a commit. + +Syntax: + +```shell +hew [] +``` + +Example with default branch name: + +```shell +git hew +``` + +Example with specific branch name: + +```shell +git hew main +``` + +Example with specific commit hash: + +```shell +git hew 4677ad893ee038b113e22f6330da6ae710712f88 +``` + +Compare these: + +* [git hew](../git-hew) +* [git hew-dry-run](../git-hew-dry-run) +* [git hew-local](../git-hew-local) +* [git hew-local-dry-run](../git-hew-local-dry-run) +* [git hew-remote](../git-hew-remote) +* [git hew-remote-dry-run](../git-hew-remote-dry-run) diff --git a/doc/git-ignore/alias.sh b/doc/git-ignore/alias.sh new file mode 100644 index 0000000..4b9bdc8 --- /dev/null +++ b/doc/git-ignore/alias.sh @@ -0,0 +1 @@ +git status | grep -P "^\t" | grep -vF .gitignore | sed "s/^\t//" >> .gitignore diff --git a/doc/git-ignore/description.md b/doc/git-ignore/description.md new file mode 100644 index 0000000..e483ad7 --- /dev/null +++ b/doc/git-ignore/description.md @@ -0,0 +1,7 @@ +Ignore all untracked files by appending them to `.gitignore`. + +Example: + +```shell +git ignore +``` diff --git a/doc/git-inbound/alias.sh b/doc/git-inbound/alias.sh new file mode 100644 index 0000000..4b689a7 --- /dev/null +++ b/doc/git-inbound/alias.sh @@ -0,0 +1 @@ +git remote update --prune diff --git a/doc/git-inbound/description.md b/doc/git-inbound/description.md new file mode 100644 index 0000000..3241aa9 --- /dev/null +++ b/doc/git-inbound/description.md @@ -0,0 +1,9 @@ +Show incoming changes compared to upstream. + +Example: + +```shell +git inbound +``` + +Compare [git outbound](../git-outbound). diff --git a/doc/git-init-empty/alias.sh b/doc/git-init-empty/alias.sh new file mode 100644 index 0000000..bdeec4b --- /dev/null +++ b/doc/git-init-empty/alias.sh @@ -0,0 +1 @@ +f() { git init && git commit --allow-empty --allow-empty-message --message ''; }; f diff --git a/doc/git-init-empty/description.md b/doc/git-init-empty/description.md new file mode 100644 index 0000000..5faaa2f --- /dev/null +++ b/doc/git-init-empty/description.md @@ -0,0 +1,10 @@ +Initalize a repo with an empty rebaseable commit. + +Example: + +```shell +git init-empty +``` + +This initialization makes it easier to do later git rebase commands, +because it enables a rebase to go all the way back to the first commit. diff --git a/doc/git-initer/alias.txt b/doc/git-initer/alias.txt new file mode 100644 index 0000000..11a098a --- /dev/null +++ b/doc/git-initer/alias.txt @@ -0,0 +1 @@ +init-empty diff --git a/doc/git-initer/description.md b/doc/git-initer/description.md new file mode 100644 index 0000000..e805abf --- /dev/null +++ b/doc/git-initer/description.md @@ -0,0 +1,13 @@ +Initalize a repo using our recommended way i.e. with an empty rebaseable commit. + +Example: + +```shell +git initer +``` + +See [git init-empty](../git-init-empty). + +This initialization makes it easier to do later git rebase commands, +because it enables a rebase to go all the way back to the first commit. + diff --git a/doc/git-initer/git-initer.gitconfig b/doc/git-initer/git-initer.gitconfig new file mode 100644 index 0000000..4ea229b --- /dev/null +++ b/doc/git-initer/git-initer.gitconfig @@ -0,0 +1,2 @@ +[alias] + initer = "init-empty" diff --git a/doc/git-intercommit/alias.sh b/doc/git-intercommit/alias.sh new file mode 100644 index 0000000..3453f8c --- /dev/null +++ b/doc/git-intercommit/alias.sh @@ -0,0 +1 @@ +sh -c 'git show $1 > .git/commit1 && git show $2 > .git/commit2 && interdiff .git/commit[12] | less -FRS' - diff --git a/doc/git-intercommit/description.md b/doc/git-intercommit/description.md new file mode 100644 index 0000000..d952ea3 --- /dev/null +++ b/doc/git-intercommit/description.md @@ -0,0 +1,11 @@ +Use interdiff to see patch modifications. + +Example: + +```shell +git intercommit +``` + +If upstream applied a slightly modified patch, and we want to see the +modifications, then we use the program `interdiff` of the patchutils package, +and call "interdiff" between commits. diff --git a/doc/git-issues/alias.sh b/doc/git-issues/alias.sh new file mode 100644 index 0000000..34090e2 --- /dev/null +++ b/doc/git-issues/alias.sh @@ -0,0 +1 @@ +sh -c "git log $1 --oneline | grep -o \"ISSUE-[0-9]\+\" | sort -u" diff --git a/doc/git-issues/description.md b/doc/git-issues/description.md new file mode 100644 index 0000000..ca16e3e --- /dev/null +++ b/doc/git-issues/description.md @@ -0,0 +1,25 @@ +List all issues mentioned in commit messages between range of commits. + +Example: + +```shell +git issues +``` + +You must adjust the alias regular expression `\\\"ISSUE-[0-9]\\+\\\"` +to be a regular expression that matches your issue tracking system. + +For Jira it should be as simple as putting your project name in place of `ISSUE`. + +Best used with tags: + +```shell +git issues v1.0..v1.1 +``` + +This alias will work with any valid commit range: + +```shell +git issues main..HEAD +``` + diff --git a/doc/git-l/alias.txt b/doc/git-l/alias.txt new file mode 100644 index 0000000..6bfe6b1 --- /dev/null +++ b/doc/git-l/alias.txt @@ -0,0 +1 @@ +log diff --git a/doc/git-l/description.md b/doc/git-l/description.md new file mode 100644 index 0000000..f8f3779 --- /dev/null +++ b/doc/git-l/description.md @@ -0,0 +1,7 @@ +Short for `git log`. + +Example: + +```shell +git l +``` diff --git a/doc/git-l/git-l.gitconfig b/doc/git-l/git-l.gitconfig new file mode 100644 index 0000000..e662cb2 --- /dev/null +++ b/doc/git-l/git-l.gitconfig @@ -0,0 +1,2 @@ +[alias] + l = "log" diff --git a/doc/git-last-tag/alias.txt b/doc/git-last-tag/alias.txt new file mode 100644 index 0000000..d27adb6 --- /dev/null +++ b/doc/git-last-tag/alias.txt @@ -0,0 +1 @@ +describe --tags --abbrev=0 diff --git a/doc/git-last-tag/description.md b/doc/git-last-tag/description.md new file mode 100644 index 0000000..e7c9c8a --- /dev/null +++ b/doc/git-last-tag/description.md @@ -0,0 +1,17 @@ +Show the last tag in the current branch. + +Example: + +```shell +git last-tag +``` + + +### Documentation for `git describe` + +
+
--tags
+
Instead of using only the annotated tags, use any tag found in refs/tags namespace. This option enables matching a lightweight (non-annotated) tag.
+
--abbrev=<n>
+
Instead of using the default 7 hexadecimal digits as the abbreviated object name, use <n> digits, or as many digits as needed to form a unique object name. An <n> of 0 will suppress long format, only showing the closest tag.
+
diff --git a/doc/git-last-tag/git-last-tag.gitconfig b/doc/git-last-tag/git-last-tag.gitconfig new file mode 100644 index 0000000..ff10859 --- /dev/null +++ b/doc/git-last-tag/git-last-tag.gitconfig @@ -0,0 +1,2 @@ +[alias] + last-tag = "describe --tags --abbrev=0" diff --git a/doc/git-last-tagged/alias.sh b/doc/git-last-tagged/alias.sh new file mode 100644 index 0000000..9ce058c --- /dev/null +++ b/doc/git-last-tagged/alias.sh @@ -0,0 +1 @@ +git describe --tags "$(git rev-list --tags --max-count=1)" diff --git a/doc/git-last-tagged/description.md b/doc/git-last-tagged/description.md new file mode 100644 index 0000000..5685b7f --- /dev/null +++ b/doc/git-last-tagged/description.md @@ -0,0 +1,7 @@ +Show the last annotated tag in all branches. + +Example: + +```shell +git last-tagged +``` diff --git a/doc/git-lfp/alias.txt b/doc/git-lfp/alias.txt new file mode 100644 index 0000000..7ae9865 --- /dev/null +++ b/doc/git-lfp/alias.txt @@ -0,0 +1 @@ +log --first-parent diff --git a/doc/git-lfp/description.md b/doc/git-lfp/description.md new file mode 100644 index 0000000..aaaacd7 --- /dev/null +++ b/doc/git-lfp/description.md @@ -0,0 +1,9 @@ +Log with first parent. + +Example: + +```shell +git lfp +``` + +This alias can be useful for teamwork for a branch that only accepts pull requests. diff --git a/doc/git-lfp/git-lfp.gitconfig b/doc/git-lfp/git-lfp.gitconfig new file mode 100644 index 0000000..a2e7293 --- /dev/null +++ b/doc/git-lfp/git-lfp.gitconfig @@ -0,0 +1,2 @@ +[alias] + lfp = "log --first-parent" diff --git a/doc/git-lg/alias.txt b/doc/git-lg/alias.txt new file mode 100644 index 0000000..0236882 --- /dev/null +++ b/doc/git-lg/alias.txt @@ -0,0 +1 @@ +log --graph diff --git a/doc/git-lg/description.md b/doc/git-lg/description.md new file mode 100644 index 0000000..b0ead96 --- /dev/null +++ b/doc/git-lg/description.md @@ -0,0 +1,7 @@ +Log with a text-based graphical representation of the commit history. + +Example: + +```shell +git lg +``` diff --git a/doc/git-lg/git-lg.gitconfig b/doc/git-lg/git-lg.gitconfig new file mode 100644 index 0000000..1d294aa --- /dev/null +++ b/doc/git-lg/git-lg.gitconfig @@ -0,0 +1,2 @@ +[alias] + lg = "log --graph" diff --git a/doc/git-ll/alias.txt b/doc/git-ll/alias.txt new file mode 100644 index 0000000..c6e1c83 --- /dev/null +++ b/doc/git-ll/alias.txt @@ -0,0 +1 @@ +log-list diff --git a/doc/git-ll/description.md b/doc/git-ll/description.md new file mode 100644 index 0000000..c1c58ba --- /dev/null +++ b/doc/git-ll/description.md @@ -0,0 +1,31 @@ +Log list - Show log list with our preferred options and short information. + +Example: + +```shell +git ll +* 2021-01-01 a1b2c3d - Add feature foo [Alice Adams] N +… +``` + +### Compare + +Compare the alias [git ll](../git-ll) a.k.a. [git log-list](../git-log-list) which is using: + + * Short date format using YYYY-MM-DD (no time, no zone) + + * Short hash commit format using abbreviated hexadecimal (not full hexadecimal) + + * Short author field using name (no email address) and signature mark + + * Short layout without columns + +And the alias [git lll](../git-lll) a.k.a. [git log-list-long](../git-log-list-long) which is using: + + * Long date format using iso8601 strict YYYY-MM-DDTHH:MM:SS+HH:MM + + * Long hash commit format using full hexadecimal displayed as name-rev + + * Long author field using name and email address and signature mark + + * Long layout with columns diff --git a/doc/git-ll/git-ll.gitconfig b/doc/git-ll/git-ll.gitconfig new file mode 100644 index 0000000..9a07730 --- /dev/null +++ b/doc/git-ll/git-ll.gitconfig @@ -0,0 +1,2 @@ +[alias] + ll = "log-list" diff --git a/doc/git-lll/alias.txt b/doc/git-lll/alias.txt new file mode 100644 index 0000000..06d7a21 --- /dev/null +++ b/doc/git-lll/alias.txt @@ -0,0 +1 @@ +log-list-long diff --git a/doc/git-lll/description.md b/doc/git-lll/description.md new file mode 100644 index 0000000..ceead90 --- /dev/null +++ b/doc/git-lll/description.md @@ -0,0 +1,31 @@ +Log list long - Show log list with our preferred options and long information. + +Example: + +```shell +git lll +* 2021-01-01T00:00:00+00:00 remotes/origin/main Add feature foo Alice Adams N +… +``` + +### Compare + +Compare the alias [git ll](../git-ll) a.k.a. [git log-list](../git-log-list) which is using: + + * Short date format using YYYY-MM-DD (no time, no zone) + + * Short hash commit format using abbreviated hexadecimal (not full hexadecimal) + + * Short author field using name (no email address) and signature mark + + * Short layout without columns + +And the alias [git lll](../git-lll) a.k.a. [git log-list-long](../git-log-list-long) which is using: + + * Long date format using iso8601 strict YYYY-MM-DDTHH:MM:SS+HH:MM + + * Long hash commit format using full hexadecimal displayed as name-rev + + * Long author field using name and email address and signature mark + + * Long layout with columns diff --git a/doc/git-lll/git-lll.gitconfig b/doc/git-lll/git-lll.gitconfig new file mode 100644 index 0000000..62fa88d --- /dev/null +++ b/doc/git-lll/git-lll.gitconfig @@ -0,0 +1,2 @@ +[alias] + lll = "log-list-long" diff --git a/doc/git-lo/alias.txt b/doc/git-lo/alias.txt new file mode 100644 index 0000000..bc6fdf4 --- /dev/null +++ b/doc/git-lo/alias.txt @@ -0,0 +1 @@ +log --oneline diff --git a/doc/git-lo/description.md b/doc/git-lo/description.md new file mode 100644 index 0000000..c481a5d --- /dev/null +++ b/doc/git-lo/description.md @@ -0,0 +1,7 @@ +Log with one line per item. + +Example: + +```shell +git lo +``` diff --git a/doc/git-lo/git-lo.gitconfig b/doc/git-lo/git-lo.gitconfig new file mode 100644 index 0000000..2b054fb --- /dev/null +++ b/doc/git-lo/git-lo.gitconfig @@ -0,0 +1,2 @@ +[alias] + lo = "log --oneline" diff --git a/doc/git-log-1-day/alias.txt b/doc/git-log-1-day/alias.txt new file mode 100644 index 0000000..3d71069 --- /dev/null +++ b/doc/git-log-1-day/alias.txt @@ -0,0 +1 @@ +log --since=1-day-ago diff --git a/doc/git-log-1-day/description.md b/doc/git-log-1-day/description.md new file mode 100644 index 0000000..0050003 --- /dev/null +++ b/doc/git-log-1-day/description.md @@ -0,0 +1,31 @@ +Show log with the recent day. + +Example: + +```shell +git log-1-day +``` + +## # Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +## # Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-1-day/git-log-1-day.gitconfig b/doc/git-log-1-day/git-log-1-day.gitconfig new file mode 100644 index 0000000..5530d9f --- /dev/null +++ b/doc/git-log-1-day/git-log-1-day.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-1-day = "log --since=1-day-ago" diff --git a/doc/git-log-1-hour/alias.txt b/doc/git-log-1-hour/alias.txt new file mode 100644 index 0000000..0f0179c --- /dev/null +++ b/doc/git-log-1-hour/alias.txt @@ -0,0 +1 @@ +log --since=1-hour-ago diff --git a/doc/git-log-1-hour/description.md b/doc/git-log-1-hour/description.md new file mode 100644 index 0000000..49f75a5 --- /dev/null +++ b/doc/git-log-1-hour/description.md @@ -0,0 +1,31 @@ +Show log with the recent hour. + +Example: + +```shell +git log-1-hour +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-1-hour/git-log-1-hour.gitconfig b/doc/git-log-1-hour/git-log-1-hour.gitconfig new file mode 100644 index 0000000..d591e7d --- /dev/null +++ b/doc/git-log-1-hour/git-log-1-hour.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-1-hour = "log --since=1-hour-ago" diff --git a/doc/git-log-1-month/alias.txt b/doc/git-log-1-month/alias.txt new file mode 100644 index 0000000..9250c2c --- /dev/null +++ b/doc/git-log-1-month/alias.txt @@ -0,0 +1 @@ +log --since=1-month-ago diff --git a/doc/git-log-1-month/description.md b/doc/git-log-1-month/description.md new file mode 100644 index 0000000..7287f08 --- /dev/null +++ b/doc/git-log-1-month/description.md @@ -0,0 +1,31 @@ +Show log with the recent month. + +Example: + +```shell +git log-1-month +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-1-month/git-log-1-month.gitconfig b/doc/git-log-1-month/git-log-1-month.gitconfig new file mode 100644 index 0000000..b793ff6 --- /dev/null +++ b/doc/git-log-1-month/git-log-1-month.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-1-month = "log --since=1-month-ago" diff --git a/doc/git-log-1-week/alias.txt b/doc/git-log-1-week/alias.txt new file mode 100644 index 0000000..ba47156 --- /dev/null +++ b/doc/git-log-1-week/alias.txt @@ -0,0 +1 @@ +log --since=1-week-ago diff --git a/doc/git-log-1-week/description.md b/doc/git-log-1-week/description.md new file mode 100644 index 0000000..01eeb05 --- /dev/null +++ b/doc/git-log-1-week/description.md @@ -0,0 +1,31 @@ +Show log with the recent week. + +Example: + +```shell +git log-1-week +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-1-week/git-log-1-week.gitconfig b/doc/git-log-1-week/git-log-1-week.gitconfig new file mode 100644 index 0000000..1068fd8 --- /dev/null +++ b/doc/git-log-1-week/git-log-1-week.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-1-week = "log --since=1-week-ago" diff --git a/doc/git-log-1-year/alias.txt b/doc/git-log-1-year/alias.txt new file mode 100644 index 0000000..1e893ea --- /dev/null +++ b/doc/git-log-1-year/alias.txt @@ -0,0 +1 @@ +log --since=1-year-ago diff --git a/doc/git-log-1-year/description.md b/doc/git-log-1-year/description.md new file mode 100644 index 0000000..289a626 --- /dev/null +++ b/doc/git-log-1-year/description.md @@ -0,0 +1,31 @@ +Show log with the recent year. + +Example: + +```shell +git log-1-year +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-1-year/git-log-1-year.gitconfig b/doc/git-log-1-year/git-log-1-year.gitconfig new file mode 100644 index 0000000..8716a0a --- /dev/null +++ b/doc/git-log-1-year/git-log-1-year.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-1-year = "log --since=1-year-ago" diff --git a/doc/git-log-date-first/alias.sh b/doc/git-log-date-first/alias.sh new file mode 100644 index 0000000..e591107 --- /dev/null +++ b/doc/git-log-date-first/alias.sh @@ -0,0 +1 @@ +git log --date-order --format=%cI | tail -1 diff --git a/doc/git-log-date-first/description.md b/doc/git-log-date-first/description.md new file mode 100644 index 0000000..c731d9e --- /dev/null +++ b/doc/git-log-date-first/description.md @@ -0,0 +1,10 @@ +Show the date of the earliest commit, in strict ISO 8601 format. + +Example: + +```shell +git log-date-first +``` + +Compare [git log-date-last](../git-log-date-last). + diff --git a/doc/git-log-date-last/alias.txt b/doc/git-log-date-last/alias.txt new file mode 100644 index 0000000..95ab006 --- /dev/null +++ b/doc/git-log-date-last/alias.txt @@ -0,0 +1 @@ +log -1 --date-order --format=%cI diff --git a/doc/git-log-date-last/description.md b/doc/git-log-date-last/description.md new file mode 100644 index 0000000..e5a0286 --- /dev/null +++ b/doc/git-log-date-last/description.md @@ -0,0 +1,9 @@ +Show the date of the latest commit, in strict ISO 8601 format. + +Example: + +```shell +git log-date-last +``` + +Compare [git log-date-first](../git-log-date-first). diff --git a/doc/git-log-date-last/git-log-date-last.gitconfig b/doc/git-log-date-last/git-log-date-last.gitconfig new file mode 100644 index 0000000..acd44ff --- /dev/null +++ b/doc/git-log-date-last/git-log-date-last.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-date-last = "log -1 --date-order --format=%cI" diff --git a/doc/git-log-fetched/alias.txt b/doc/git-log-fetched/alias.txt new file mode 100644 index 0000000..0942cc4 --- /dev/null +++ b/doc/git-log-fetched/alias.txt @@ -0,0 +1 @@ +log --oneline HEAD..origin/main diff --git a/doc/git-log-fetched/description.md b/doc/git-log-fetched/description.md new file mode 100644 index 0000000..6695ec0 --- /dev/null +++ b/doc/git-log-fetched/description.md @@ -0,0 +1,9 @@ +Show log of fetched commits vs. origin/main. + +Example: + +```shell +git log-fetched +``` + + diff --git a/doc/git-log-fetched/git-log-fetched.gitconfig b/doc/git-log-fetched/git-log-fetched.gitconfig new file mode 100644 index 0000000..f6b3177 --- /dev/null +++ b/doc/git-log-fetched/git-log-fetched.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-fetched = "log --oneline HEAD..origin/main" diff --git a/doc/git-log-fresh/alias.txt b/doc/git-log-fresh/alias.txt new file mode 100644 index 0000000..1c3b9c9 --- /dev/null +++ b/doc/git-log-fresh/alias.txt @@ -0,0 +1 @@ +log ORIG_HEAD.. --stat --no-merges diff --git a/doc/git-log-fresh/description.md b/doc/git-log-fresh/description.md new file mode 100644 index 0000000..07c6096 --- /dev/null +++ b/doc/git-log-fresh/description.md @@ -0,0 +1,7 @@ +Show log of new commits after you fetched, with stats, excluding merges. + +Example: + +```shell +git log-fresh +``` diff --git a/doc/git-log-fresh/git-log-fresh.gitconfig b/doc/git-log-fresh/git-log-fresh.gitconfig new file mode 100644 index 0000000..e6cbca0 --- /dev/null +++ b/doc/git-log-fresh/git-log-fresh.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-fresh = "log ORIG_HEAD.. --stat --no-merges" diff --git a/doc/git-log-graph/alias.txt b/doc/git-log-graph/alias.txt new file mode 100644 index 0000000..26d5e2e --- /dev/null +++ b/doc/git-log-graph/alias.txt @@ -0,0 +1 @@ +log --graph --all --oneline --decorate diff --git a/doc/git-log-graph/description.md b/doc/git-log-graph/description.md new file mode 100644 index 0000000..1333ed7 --- /dev/null +++ b/doc/git-log-graph/description.md @@ -0,0 +1 @@ +TODO diff --git a/doc/git-log-graph/git-log-graph.gitconfig b/doc/git-log-graph/git-log-graph.gitconfig new file mode 100644 index 0000000..167947b --- /dev/null +++ b/doc/git-log-graph/git-log-graph.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-graph = "log --graph --all --oneline --decorate" diff --git a/doc/git-log-list-long/alias.txt b/doc/git-log-list-long/alias.txt new file mode 100644 index 0000000..f8bbf08 --- /dev/null +++ b/doc/git-log-list-long/alias.txt @@ -0,0 +1 @@ +log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cblue%ad %C(auto)%h%Creset -%C(auto)%d%Creset %s %Cblue[%aN <%aE>]%Creset %Cblue%G?%Creset' diff --git a/doc/git-log-list-long/description.md b/doc/git-log-list-long/description.md new file mode 100644 index 0000000..92a8915 --- /dev/null +++ b/doc/git-log-list-long/description.md @@ -0,0 +1,32 @@ +Show log list with our preferred options and long information. + +Example: + +```shell +git log-list-long +* 2021-01-01T00:00:00+00:00 remotes/origin/main Add feature foo Alice Adams N +… +``` + + +### Compare + +Compare the alias [git ll](../git-ll) a.k.a. [git log-list](../git-log-list) which is using: + + * Short date format using YYYY-MM-DD (no time, no zone) + + * Short hash commit format using abbreviated hexadecimal (not full hexadecimal) + + * Short author field using name (no email address) and signature mark + + * Short layout without columns + +And the alias [git lll](../git-lll) a.k.a. [git log-list-long](../git-log-list-long) which is using: + + * Long date format using iso8601 strict YYYY-MM-DDTHH:MM:SS+HH:MM + + * Long hash commit format using full hexadecimal displayed as name-rev + + * Long author field using name and email address and signature mark + + * Long layout with columns diff --git a/doc/git-log-list-long/git-log-list-long.gitconfig b/doc/git-log-list-long/git-log-list-long.gitconfig new file mode 100644 index 0000000..5e82591 --- /dev/null +++ b/doc/git-log-list-long/git-log-list-long.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-list-long = "log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cblue%ad %C(auto)%h%Creset -%C(auto)%d%Creset %s %Cblue[%aN <%aE>]%Creset %Cblue%G?%Creset'" diff --git a/doc/git-log-list/alias.txt b/doc/git-log-list/alias.txt new file mode 100644 index 0000000..5e1361c --- /dev/null +++ b/doc/git-log-list/alias.txt @@ -0,0 +1 @@ +log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cblue%ad %C(auto)%h%Creset -%C(auto)%d%Creset %s %Cblue[%aN]%Creset %Cblue%G?%Creset' diff --git a/doc/git-log-list/description.md b/doc/git-log-list/description.md new file mode 100644 index 0000000..ed5de9e --- /dev/null +++ b/doc/git-log-list/description.md @@ -0,0 +1,32 @@ +Show log list with our preferred options and short information. + +Example: + +```shell +git log-list +* 2021-01-01 a1b2c3d - Add feature foo [Alice Adams] N +… +``` + + +### Compare + +Compare the alias [git ll](../git-ll) a.k.a. [git log-list](../git-log-list) which is using: + + * Short date format using YYYY-MM-DD (no time, no zone) + + * Short hash commit format using abbreviated hexadecimal (not full hexadecimal) + + * Short author field using name (no email address) and signature mark + + * Short layout without columns + +And the alias [git lll](../git-lll) a.k.a. [git log-list-long](../git-log-list-long) which is using: + + * Long date format using iso8601 strict YYYY-MM-DDTHH:MM:SS+HH:MM + + * Long hash commit format using full hexadecimal displayed as name-rev + + * Long author field using name and email address and signature mark + + * Long layout with columns diff --git a/doc/git-log-list/git-log-list.gitconfig b/doc/git-log-list/git-log-list.gitconfig new file mode 100644 index 0000000..98decc8 --- /dev/null +++ b/doc/git-log-list/git-log-list.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-list = "log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cblue%ad %C(auto)%h%Creset -%C(auto)%d%Creset %s %Cblue[%aN]%Creset %Cblue%G?%Creset'" diff --git a/doc/git-log-local/alias.txt b/doc/git-log-local/alias.txt new file mode 100644 index 0000000..02616ad --- /dev/null +++ b/doc/git-log-local/alias.txt @@ -0,0 +1 @@ +log --oneline origin..HEAD diff --git a/doc/git-log-local/description.md b/doc/git-log-local/description.md new file mode 100644 index 0000000..cf873b4 --- /dev/null +++ b/doc/git-log-local/description.md @@ -0,0 +1 @@ + diff --git a/doc/git-log-local/git-log-local.gitconfig b/doc/git-log-local/git-log-local.gitconfig new file mode 100644 index 0000000..c77dddc --- /dev/null +++ b/doc/git-log-local/git-log-local.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-local = "log --oneline origin..HEAD" diff --git a/doc/git-log-local/index.md b/doc/git-log-local/index.md new file mode 100644 index 0000000..afb2050 --- /dev/null +++ b/doc/git-log-local/index.md @@ -0,0 +1,3 @@ +# git log-local + + diff --git a/doc/git-log-my-day/alias.sh b/doc/git-log-my-day/alias.sh new file mode 100644 index 0000000..4c3ca9c --- /dev/null +++ b/doc/git-log-my-day/alias.sh @@ -0,0 +1 @@ +git log --author "$(git config user.email)" --since=1-day-ago diff --git a/doc/git-log-my-day/description.md b/doc/git-log-my-day/description.md new file mode 100644 index 0000000..6ffa471 --- /dev/null +++ b/doc/git-log-my-day/description.md @@ -0,0 +1,31 @@ +Show log with my own recent day. + +Example: + +```shell +git log-my-day +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-my-hour/alias.sh b/doc/git-log-my-hour/alias.sh new file mode 100644 index 0000000..e025795 --- /dev/null +++ b/doc/git-log-my-hour/alias.sh @@ -0,0 +1 @@ +git log --author "$(git config user.email)" --since=1-hour-ago diff --git a/doc/git-log-my-hour/description.md b/doc/git-log-my-hour/description.md new file mode 100644 index 0000000..c2f51ac --- /dev/null +++ b/doc/git-log-my-hour/description.md @@ -0,0 +1,31 @@ +Show log with my own recent hour. + +Example: + +```shell +git log-my-hour +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-my-month/alias.sh b/doc/git-log-my-month/alias.sh new file mode 100644 index 0000000..a37ae08 --- /dev/null +++ b/doc/git-log-my-month/alias.sh @@ -0,0 +1 @@ +git log --author "$(git config user.email)" --since=1-month-ago diff --git a/doc/git-log-my-month/description.md b/doc/git-log-my-month/description.md new file mode 100644 index 0000000..a45a2c5 --- /dev/null +++ b/doc/git-log-my-month/description.md @@ -0,0 +1,31 @@ +Show log with my own recent month. + +Example: + +```shell +git log-my-month +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-my-week/alias.sh b/doc/git-log-my-week/alias.sh new file mode 100644 index 0000000..dbe5d5d --- /dev/null +++ b/doc/git-log-my-week/alias.sh @@ -0,0 +1 @@ +git log --author "$(git config user.email)" --since=1-week-ago diff --git a/doc/git-log-my-week/description.md b/doc/git-log-my-week/description.md new file mode 100644 index 0000000..d1fa524 --- /dev/null +++ b/doc/git-log-my-week/description.md @@ -0,0 +1,31 @@ +Show log with my own recent week. + +Example: + +```shell +git log-my-week +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-my-year/alias.sh b/doc/git-log-my-year/alias.sh new file mode 100644 index 0000000..f5a7afd --- /dev/null +++ b/doc/git-log-my-year/alias.sh @@ -0,0 +1 @@ +git log --author "$(git config user.email)" --since=1-year-ago diff --git a/doc/git-log-my-year/description.md b/doc/git-log-my-year/description.md new file mode 100644 index 0000000..adbe088 --- /dev/null +++ b/doc/git-log-my-year/description.md @@ -0,0 +1,31 @@ +Show log with my own recent year. + +Example: + +```shell +git log-my-year +``` + +### Compare: Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago +``` + +### Compare: Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` diff --git a/doc/git-log-my/alias.sh b/doc/git-log-my/alias.sh new file mode 100644 index 0000000..308c034 --- /dev/null +++ b/doc/git-log-my/alias.sh @@ -0,0 +1 @@ +git log --author "$(git config user.email)" diff --git a/doc/git-log-my/description.md b/doc/git-log-my/description.md new file mode 100644 index 0000000..fb28774 --- /dev/null +++ b/doc/git-log-my/description.md @@ -0,0 +1,7 @@ +Show log for my own commits by my own user email. + +Example: + +```shell +git log-my +``` diff --git a/doc/git-log-of-count-and-day-of-week/alias.sh b/doc/git-log-of-count-and-day-of-week/alias.sh new file mode 100644 index 0000000..7b53a8e --- /dev/null +++ b/doc/git-log-of-count-and-day-of-week/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format-with-date "%ad" "%u" "$@"; }; f diff --git a/doc/git-log-of-count-and-day-of-week/description.md b/doc/git-log-of-count-and-day-of-week/description.md new file mode 100644 index 0000000..fe9c423 --- /dev/null +++ b/doc/git-log-of-count-and-day-of-week/description.md @@ -0,0 +1,9 @@ +Show log with count and day of week. + +Example: + +```shell +git log-of-count-and-day-of-week +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-day/alias.sh b/doc/git-log-of-count-and-day/alias.sh new file mode 100644 index 0000000..bf2967d --- /dev/null +++ b/doc/git-log-of-count-and-day/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format-with-date "%ad" "%Y-%m-%d" "$@" ; }; f diff --git a/doc/git-log-of-count-and-day/description.md b/doc/git-log-of-count-and-day/description.md new file mode 100644 index 0000000..debea98 --- /dev/null +++ b/doc/git-log-of-count-and-day/description.md @@ -0,0 +1,9 @@ +Show log with count and day. + +Example: + +```shell +git log-of-count-and-day +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-email/alias.sh b/doc/git-log-of-count-and-email/alias.sh new file mode 100644 index 0000000..95bd834 --- /dev/null +++ b/doc/git-log-of-count-and-email/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format "%aE" "$@"; }; f diff --git a/doc/git-log-of-count-and-email/description.md b/doc/git-log-of-count-and-email/description.md new file mode 100644 index 0000000..fd94428 --- /dev/null +++ b/doc/git-log-of-count-and-email/description.md @@ -0,0 +1,9 @@ +Show log with count and email. + +Example: + +```shell +git log-of-count-and-email +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-format-with-date/alias.sh b/doc/git-log-of-count-and-format-with-date/alias.sh new file mode 100644 index 0000000..429f0cf --- /dev/null +++ b/doc/git-log-of-count-and-format-with-date/alias.sh @@ -0,0 +1 @@ +f() { format="$1"; shift; date_format="$1"; shift; git log "$@" --format=oneline --format="$format" --date=format:"$date_format" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) "%", i}}' | sort -nr; }; f diff --git a/doc/git-log-of-count-and-format-with-date/description.md b/doc/git-log-of-count-and-format-with-date/description.md new file mode 100644 index 0000000..862060a --- /dev/null +++ b/doc/git-log-of-count-and-format-with-date/description.md @@ -0,0 +1,9 @@ +Show log with count and custom format string with date. + +Example: + +```shell +git log-of-count-and-format-with-date +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-format/alias.sh b/doc/git-log-of-count-and-format/alias.sh new file mode 100644 index 0000000..2e27f3e --- /dev/null +++ b/doc/git-log-of-count-and-format/alias.sh @@ -0,0 +1 @@ +f() { format="$1"; shift; git log "$@" --format=oneline --format="$format" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) "%", i}}' | sort -nr; }; f diff --git a/doc/git-log-of-count-and-format/description.md b/doc/git-log-of-count-and-format/description.md new file mode 100644 index 0000000..2dd85b6 --- /dev/null +++ b/doc/git-log-of-count-and-format/description.md @@ -0,0 +1,9 @@ +Show a count of log entries and a custom format string. + +Example: + +```shell +git log-of-count-and-format +``` + +Compare [git log-of-format-and-count](../git-log-of-format-and-count). diff --git a/doc/git-log-of-count-and-hour-of-day/alias.sh b/doc/git-log-of-count-and-hour-of-day/alias.sh new file mode 100644 index 0000000..cfa3fb8 --- /dev/null +++ b/doc/git-log-of-count-and-hour-of-day/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format-with-date "%ad" "%H" "$@"; }; f diff --git a/doc/git-log-of-count-and-hour-of-day/description.md b/doc/git-log-of-count-and-hour-of-day/description.md new file mode 100644 index 0000000..a51fd3c --- /dev/null +++ b/doc/git-log-of-count-and-hour-of-day/description.md @@ -0,0 +1,9 @@ +Show log with count and hour of day. + +Example: + +```shell +git-log-of-count-and-hour-of-day +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-hour/alias.sh b/doc/git-log-of-count-and-hour/alias.sh new file mode 100644 index 0000000..a0e970f --- /dev/null +++ b/doc/git-log-of-count-and-hour/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format-with-date "%ad" "%Y-%m-%dT%H" "$@" ; }; f diff --git a/doc/git-log-of-count-and-hour/description.md b/doc/git-log-of-count-and-hour/description.md new file mode 100644 index 0000000..efa3047 --- /dev/null +++ b/doc/git-log-of-count-and-hour/description.md @@ -0,0 +1,9 @@ +Show log with count and hour. + +Example: + +```shell +git-log-of-count-and-hour +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-month/alias.sh b/doc/git-log-of-count-and-month/alias.sh new file mode 100644 index 0000000..f5821cc --- /dev/null +++ b/doc/git-log-of-count-and-month/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format-with-date "%ad" "%Y-%m" "$@" ; }; f diff --git a/doc/git-log-of-count-and-month/description.md b/doc/git-log-of-count-and-month/description.md new file mode 100644 index 0000000..7827091 --- /dev/null +++ b/doc/git-log-of-count-and-month/description.md @@ -0,0 +1,9 @@ +Show log with count and month. + +Example: + +```shell +git-log-of-count-and-month +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-week-of-year/alias.sh b/doc/git-log-of-count-and-week-of-year/alias.sh new file mode 100644 index 0000000..fc6cb67 --- /dev/null +++ b/doc/git-log-of-count-and-week-of-year/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format-with-date "%ad" "%V" "$@"; }; f diff --git a/doc/git-log-of-count-and-week-of-year/description.md b/doc/git-log-of-count-and-week-of-year/description.md new file mode 100644 index 0000000..e309184 --- /dev/null +++ b/doc/git-log-of-count-and-week-of-year/description.md @@ -0,0 +1,9 @@ +Show log with count and week of year. + +Example: + +```shell +git-log-of-count-and-week-of-year +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-week/alias.sh b/doc/git-log-of-count-and-week/alias.sh new file mode 100644 index 0000000..d64634a --- /dev/null +++ b/doc/git-log-of-count-and-week/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format-with-date "%ad" "%Y#%V" "$@"; }; f diff --git a/doc/git-log-of-count-and-week/description.md b/doc/git-log-of-count-and-week/description.md new file mode 100644 index 0000000..4b85efa --- /dev/null +++ b/doc/git-log-of-count-and-week/description.md @@ -0,0 +1,9 @@ +Show log with count and week. + +Example: + +```shell +git-log-of-count-and-week +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-count-and-year/alias.sh b/doc/git-log-of-count-and-year/alias.sh new file mode 100644 index 0000000..4857e32 --- /dev/null +++ b/doc/git-log-of-count-and-year/alias.sh @@ -0,0 +1 @@ +f() { git log-of-count-and-format-with-date "%ad" "%Y" "$@" ; }; f diff --git a/doc/git-log-of-count-and-year/description.md b/doc/git-log-of-count-and-year/description.md new file mode 100644 index 0000000..3490eb4 --- /dev/null +++ b/doc/git-log-of-count-and-year/description.md @@ -0,0 +1,9 @@ +Show log with count and year. + +Example: + +```shell +git-log-of-count-and-year +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-day-and-count/alias.sh b/doc/git-log-of-day-and-count/alias.sh new file mode 100644 index 0000000..307882e --- /dev/null +++ b/doc/git-log-of-day-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count-with-date "%ad" "%Y-%m-%d" "$@" ; }; f diff --git a/doc/git-log-of-day-and-count/description.md b/doc/git-log-of-day-and-count/description.md new file mode 100644 index 0000000..724d27f --- /dev/null +++ b/doc/git-log-of-day-and-count/description.md @@ -0,0 +1,9 @@ +Show log with day and count. + +Example: + +```shell +git-log-of-day-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-day-of-week-and-count/alias.sh b/doc/git-log-of-day-of-week-and-count/alias.sh new file mode 100644 index 0000000..4b325aa --- /dev/null +++ b/doc/git-log-of-day-of-week-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count-with-date "%ad" "%u" "$@"; }; f diff --git a/doc/git-log-of-day-of-week-and-count/description.md b/doc/git-log-of-day-of-week-and-count/description.md new file mode 100644 index 0000000..b29016e --- /dev/null +++ b/doc/git-log-of-day-of-week-and-count/description.md @@ -0,0 +1,9 @@ +Show log with day of week and count. + +Example: + +```shell +git-log-of-day-of-week-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-email-and-count/alias.sh b/doc/git-log-of-email-and-count/alias.sh new file mode 100644 index 0000000..89d5f10 --- /dev/null +++ b/doc/git-log-of-email-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count "%aE" "$@"; }; f diff --git a/doc/git-log-of-email-and-count/description.md b/doc/git-log-of-email-and-count/description.md new file mode 100644 index 0000000..391f556 --- /dev/null +++ b/doc/git-log-of-email-and-count/description.md @@ -0,0 +1,9 @@ +Show log with email and count. + +Example: + +```shell +git-log-of-email-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-format-and-count-with-date/alias.sh b/doc/git-log-of-format-and-count-with-date/alias.sh new file mode 100644 index 0000000..f2a79ac --- /dev/null +++ b/doc/git-log-of-format-and-count-with-date/alias.sh @@ -0,0 +1 @@ +f() { format="$1"; shift; date_format="$1"; shift; git log "$@" --format=oneline --format="$format" --date=format:"$date_format" | awk '{a[$0]++}END{for(i in a){print i, a[i], int((a[i]/NR)*100) "%"}}' | sort -r; }; f diff --git a/doc/git-log-of-format-and-count-with-date/description.md b/doc/git-log-of-format-and-count-with-date/description.md new file mode 100644 index 0000000..2d51e6d --- /dev/null +++ b/doc/git-log-of-format-and-count-with-date/description.md @@ -0,0 +1,9 @@ +Show log with a custom format string and a count and a date. + +Example: + +```shell +git-log-of-format-and-count-with-date +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-format-and-count/alias.sh b/doc/git-log-of-format-and-count/alias.sh new file mode 100644 index 0000000..55e063f --- /dev/null +++ b/doc/git-log-of-format-and-count/alias.sh @@ -0,0 +1 @@ +f() { format="$1"; shift; git log "$@" --format=oneline --format="$format" | awk '{a[$0]++}END{for(i in a){print i, a[i], int((a[i]/NR)*100) "%"}}' | sort; }; f diff --git a/doc/git-log-of-format-and-count/description.md b/doc/git-log-of-format-and-count/description.md new file mode 100644 index 0000000..ee602ba --- /dev/null +++ b/doc/git-log-of-format-and-count/description.md @@ -0,0 +1,9 @@ +Show log with a custom format string and count. + +Example: + +```shell +git log-of-format-and-count +``` + +Compare [git log-of-count-and-format](../git-log-of-count-and-format). diff --git a/doc/git-log-of-hour-and-count/alias.sh b/doc/git-log-of-hour-and-count/alias.sh new file mode 100644 index 0000000..66d85b9 --- /dev/null +++ b/doc/git-log-of-hour-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count-with-date "%ad" "%Y-%m-%dT%H" "$@" ; }; f diff --git a/doc/git-log-of-hour-and-count/description.md b/doc/git-log-of-hour-and-count/description.md new file mode 100644 index 0000000..0c8f7d5 --- /dev/null +++ b/doc/git-log-of-hour-and-count/description.md @@ -0,0 +1,9 @@ +Show log with hour and count. + +Example: + +```shell +git-log-of-hour-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-hour-of-day-and-count/alias.sh b/doc/git-log-of-hour-of-day-and-count/alias.sh new file mode 100644 index 0000000..7fd6069 --- /dev/null +++ b/doc/git-log-of-hour-of-day-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count-with-date "%ad" "%H" "$@"; }; f diff --git a/doc/git-log-of-hour-of-day-and-count/description.md b/doc/git-log-of-hour-of-day-and-count/description.md new file mode 100644 index 0000000..d0c3400 --- /dev/null +++ b/doc/git-log-of-hour-of-day-and-count/description.md @@ -0,0 +1,9 @@ +Show log with hour of day and count. + +Example: + +```shell +git-log-of-hour-of-day-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-month-and-count/alias.sh b/doc/git-log-of-month-and-count/alias.sh new file mode 100644 index 0000000..afbb247 --- /dev/null +++ b/doc/git-log-of-month-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count-with-date "%ad" "%Y-%m" "$@" ; }; f diff --git a/doc/git-log-of-month-and-count/description.md b/doc/git-log-of-month-and-count/description.md new file mode 100644 index 0000000..74aa71b --- /dev/null +++ b/doc/git-log-of-month-and-count/description.md @@ -0,0 +1,9 @@ +Show log with month and count. + +Example: + +```shell +git-log-of-month-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-week-and-count/alias.sh b/doc/git-log-of-week-and-count/alias.sh new file mode 100644 index 0000000..bd30325 --- /dev/null +++ b/doc/git-log-of-week-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count-with-date "%ad" "%Y#%V" "$@"; }; f diff --git a/doc/git-log-of-week-and-count/description.md b/doc/git-log-of-week-and-count/description.md new file mode 100644 index 0000000..21765d7 --- /dev/null +++ b/doc/git-log-of-week-and-count/description.md @@ -0,0 +1,9 @@ +Show log with week and count. + +Example: + +```shell +git-log-of-week-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-week-of-year-and-count/alias.sh b/doc/git-log-of-week-of-year-and-count/alias.sh new file mode 100644 index 0000000..283ceda --- /dev/null +++ b/doc/git-log-of-week-of-year-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count-with-date "%ad" "%V" "$@"; }; f diff --git a/doc/git-log-of-week-of-year-and-count/description.md b/doc/git-log-of-week-of-year-and-count/description.md new file mode 100644 index 0000000..bb2a35d --- /dev/null +++ b/doc/git-log-of-week-of-year-and-count/description.md @@ -0,0 +1,9 @@ +Show log with week of year and count. + +Example: + +```shell +git-log-of-week-of-year-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of-year-and-count/alias.sh b/doc/git-log-of-year-and-count/alias.sh new file mode 100644 index 0000000..f82b333 --- /dev/null +++ b/doc/git-log-of-year-and-count/alias.sh @@ -0,0 +1 @@ +f() { git log-of-format-and-count-with-date "%ad" "%Y" "$@" ; }; f diff --git a/doc/git-log-of-year-and-count/description.md b/doc/git-log-of-year-and-count/description.md new file mode 100644 index 0000000..99827e9 --- /dev/null +++ b/doc/git-log-of-year-and-count/description.md @@ -0,0 +1,9 @@ +Show log with year and count. + +Example: + +```shell +git-log-of-year-and-count +``` + +Compare [`git log-of-*`](../git-log-of). diff --git a/doc/git-log-of/description.md b/doc/git-log-of/description.md new file mode 100644 index 0000000..3f8bc0b --- /dev/null +++ b/doc/git-log-of/description.md @@ -0,0 +1,212 @@ +# git log-of-* + +## Show log entries using a count and a custom format string + + +## # Show a specific format string and its number of log entries + +Git alias: + +```git +log-of-format-and-count = "!f() { format=\"$1\"; shift; git log $@ --format=oneline --format="$format" | awk '{a[$0]++}END{for(i in a){print i, a[i], int((a[i]/NR)*100) \"%\"}}' | sort; }; f" + +log-of-count-and-format = "!f() { format=\"$1\"; shift; git log $@ --format=oneline --format="$format" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) \"%\", i}}' | sort -nr; }; f" +``` + +Example: + +```shell +git log-of-format-and-count + +git log-of-count-and-format +``` + + +## # Show the number of log entries by a specific format string and date format string + +Git alias: + +```git +log-of-format-and-count-with-date = "!f() { format=\"$1\"; shift; date_format=\"$1\"; shift; git log $@ --format=oneline --format=\"$format\" --date=format:\"$date_format\" | awk '{a[$0]++}END{for(i in a){print i, a[i], int((a[i]/NR)*100) \"%\"}}' | sort -r; }; f" + +log-of-count-and-format-with-date = "!f() { format=\"$1\"; shift; date_format=\"$1\"; shift; git log $@ --format=oneline --format=\"$format\" --date=format:\"$date_format\" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) \"%\", i}}' | sort -nr; }; f" +``` + +Example: + +```shell +git log-of-format-and-count-with-date + +git log-of-count-and-format-with-date +``` + + +## # Show the number of log items by email + +Git alias: + +```git +log-of-email-and-count = "!f() { git log-of-format-and-count \"%aE\" $@; }; f" + +log-of-count-and-email = "!f() { git log-of-count-and-format \"%aE\" $@; }; f" +``` + +Example: + +```shell +git log-of-email-and-count + +git log-of-count-and-email +``` + + +## # Show the number of log items by hour + +Git alias: + +```git +log-of-hour-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y-%m-%dT%H\" $@ ; }; f" + +log-of-count-and-hour = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y-%m-%dT%H\" $@ ; }; f" +``` + +Example: + +```shell +git log-of-hour-and-count + +git log-of-count-and-hour +``` + + +## # Show the number of log items by day + +Git alias: + +```git +log-of-day-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y-%m-%d\" $@ ; }; f" + +log-of-count-and-day = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y-%m-%d\" $@ ; }; f" +``` + +Example: + +```shell +git log-of-day-and-count + +git log-of-count-and-day +``` + + +## # Show the number of log items by week + +Git alias: + +```git +log-of-week-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y#%V\" $@; }; f" + +log-of-count-and-week = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y#%V\" $@; }; f" +``` + +Example: + +```shell +git log-of-week-and-count + +git log-of-count-and-week +``` + + +## # Show the number of log items by month + +Git alias: + +```git +log-of-month-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y-%m\" $@ ; }; f" + +log-of-count-and-month = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y-%m\" $@ ; }; f" +``` + +Example: + +```shell +git log-of-month-and-count + +git log-of-count-and-month +``` + + +## # Show the number of log items by year + +Git alias: + +```git +log-of-year-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y\" $@ ; }; f" + +log-of-count-and-year = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y\" $@ ; }; f" +``` + +Example: + +```shell +git log-of-year-and-count + +git log-of-count-and-year +``` + + +## # Show the number of log items by hour of day + +Git alias: + +```git +log-of-hour-of-day-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%H\" $@; }; f" + +log-of-count-and-hour-of-day = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%H\" $@; }; f" +``` + +Example: + +```shell +git log-of-hour-of-day-and-count + +git log-of-count-and-hour-of-day +``` + + +## # Show the number of log items by day of week + +Git alias: + +```git +log-of-day-of-week-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%u\" $@; }; f" + +log-of-count-and-day-of-week = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%u\" $@; }; f" +``` + +Example: + +```shell +git log-of-day-of-week-and-count + +git log-of-count-and-day-of-week +``` + + +## # Show the number of log items by week of year + +Git alias: + +```git +log-of-week-of-year-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%V\" $@; }; f" + +log-of-count-and-week-of-year = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%V\" $@; }; f" +``` + +Example: + +```shell +git log-of-week-of-year-and-count + +git log-of-count-and-week-of-year +``` diff --git a/doc/git-log-refs/alias.txt b/doc/git-log-refs/alias.txt new file mode 100644 index 0000000..acd766b --- /dev/null +++ b/doc/git-log-refs/alias.txt @@ -0,0 +1 @@ +log --all --graph --decorate --oneline --simplify-by-decoration --no-merges diff --git a/doc/git-log-refs/description.md b/doc/git-log-refs/description.md new file mode 100644 index 0000000..c5762db --- /dev/null +++ b/doc/git-log-refs/description.md @@ -0,0 +1,7 @@ +Show log with commits that are referred by some branch or tag. + +Example: + +```shell +git log-refs +``` diff --git a/doc/git-log-refs/git-log-refs.gitconfig b/doc/git-log-refs/git-log-refs.gitconfig new file mode 100644 index 0000000..752f36c --- /dev/null +++ b/doc/git-log-refs/git-log-refs.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-refs = "log --all --graph --decorate --oneline --simplify-by-decoration --no-merges" diff --git a/doc/git-log-timeline/alias.txt b/doc/git-log-timeline/alias.txt new file mode 100644 index 0000000..b36d378 --- /dev/null +++ b/doc/git-log-timeline/alias.txt @@ -0,0 +1 @@ +log --format='%h %an %ar - %s' diff --git a/doc/git-log-timeline/description.md b/doc/git-log-timeline/description.md new file mode 100644 index 0000000..1333ed7 --- /dev/null +++ b/doc/git-log-timeline/description.md @@ -0,0 +1 @@ +TODO diff --git a/doc/git-log-timeline/git-log-timeline.gitconfig b/doc/git-log-timeline/git-log-timeline.gitconfig new file mode 100644 index 0000000..edb9dfa --- /dev/null +++ b/doc/git-log-timeline/git-log-timeline.gitconfig @@ -0,0 +1,2 @@ +[alias] + log-timeline = "log --format='%h %an %ar - %s'" diff --git a/doc/git-log/description.md b/doc/git-log/description.md new file mode 100644 index 0000000..d72e173 --- /dev/null +++ b/doc/git-log/description.md @@ -0,0 +1,94 @@ +# git log + +## Log helpers + +Git alias: + +```git +# Show log list in our preferred format for our key performance indicators. A.k.a. `ll`. +# +# * Short date format using YYYY-MM-DD (no time, no zone) +# * Short hash commit format using abbreviated hexadecimal (not full hexadecimal) +# * Short author field using name (no email address) and signature mark +# * Short layout without columns +# +log-list = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cblue%ad %C(auto)%h%Creset -%C(auto)%d%Creset %s %Cblue[%aN]%Creset %Cblue%G?%Creset' + +# Show log list in our preferred format for our key performance indicators, with long items. A.k.a. `lll`. +# +# * Long date format using iso8601 strict YYYY-MM-DDTHH:MM:SS+HH:MM +# * Long hash commit format using full hexadecimal displayed as name-rev +# * Long author field using name and email address and signature mark +# * Long layout with columns +# +log-list-long = log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cblue%ad %C(auto)%h%Creset -%C(auto)%d%Creset %s %Cblue[%aN <%aE>]%Creset %Cblue%G?%Creset' + +# Show log with dates in our local timezone +log-local = log --date=local + +# Show log as a graph +log-graph = log --graph --all --oneline --decorate + +# TODO +log-refs = log --all --graph --decorate --oneline --simplify-by-decoration --no-merges +log-timeline = log --format='%h %an %ar - %s' +log-local = log --oneline origin..HEAD +log-fetched = log --oneline HEAD..origin/main +``` + +Example: + +```shell +git log-list +git log-list-long +git log-local +git log-graph +git log-refs +git log-timeline +git log-local +git log-fetched +``` + + +### Show log with the recent hour, day, week, month, year + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +log-1-day = log --since=1-day-ago +log-1-week = log --since=1-week-ago +log-1-month = log --since=1-month-ago +log-1-year = log --since=1-year-ago + +Example: + +```shell +git log-1-hour +git log-1-day +git log-1-week +git log-1-month +git log-1-year +``` + +### Show log with my own recent hour, day, week, month, year + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +log-my-day = log --author $(git config user.email) --since=1-day-ago +log-my-week = log --author $(git config user.email) --since=1-week-ago +log-my-month = log --author $(git config user.email) --since=1-month-ago +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` + +Example: + +```shell +git log-my-hour +git log-my-day +git log-my-week +git log-my-month +git log-my-year +``` diff --git a/doc/git-lor/alias.txt b/doc/git-lor/alias.txt new file mode 100644 index 0000000..889af0d --- /dev/null +++ b/doc/git-lor/alias.txt @@ -0,0 +1 @@ +log --oneline --reverse diff --git a/doc/git-lor/description.md b/doc/git-lor/description.md new file mode 100644 index 0000000..b6f18ca --- /dev/null +++ b/doc/git-lor/description.md @@ -0,0 +1,7 @@ +Log with one line per item, in reverse order i.e. recent items first. + +Example: + +```shell +git lor +``` diff --git a/doc/git-lor/git-lor.gitconfig b/doc/git-lor/git-lor.gitconfig new file mode 100644 index 0000000..aa7b2ee --- /dev/null +++ b/doc/git-lor/git-lor.gitconfig @@ -0,0 +1,2 @@ +[alias] + lor = "log --oneline --reverse" diff --git a/doc/git-lp/alias.txt b/doc/git-lp/alias.txt new file mode 100644 index 0000000..73a2e13 --- /dev/null +++ b/doc/git-lp/alias.txt @@ -0,0 +1 @@ +log --patch diff --git a/doc/git-lp/description.md b/doc/git-lp/description.md new file mode 100644 index 0000000..19c0343 --- /dev/null +++ b/doc/git-lp/description.md @@ -0,0 +1,7 @@ +Log with patch generation. + +Example: + +```shell +git lp +``` diff --git a/doc/git-lp/git-lp.gitconfig b/doc/git-lp/git-lp.gitconfig new file mode 100644 index 0000000..97186e7 --- /dev/null +++ b/doc/git-lp/git-lp.gitconfig @@ -0,0 +1,2 @@ +[alias] + lp = "log --patch" diff --git a/doc/git-ls/alias.txt b/doc/git-ls/alias.txt new file mode 100644 index 0000000..88ac81a --- /dev/null +++ b/doc/git-ls/alias.txt @@ -0,0 +1 @@ +ls-files diff --git a/doc/git-ls/description.md b/doc/git-ls/description.md new file mode 100644 index 0000000..11cf1ab --- /dev/null +++ b/doc/git-ls/description.md @@ -0,0 +1,7 @@ +List files in the index and the working tree; like Unix `ls` command. + +Example: + +```shell +git ls +``` diff --git a/doc/git-ls/git-ls.gitconfig b/doc/git-ls/git-ls.gitconfig new file mode 100644 index 0000000..98656a1 --- /dev/null +++ b/doc/git-ls/git-ls.gitconfig @@ -0,0 +1,2 @@ +[alias] + ls = "ls-files" diff --git a/doc/git-lsd/alias.txt b/doc/git-lsd/alias.txt new file mode 100644 index 0000000..58eda6c --- /dev/null +++ b/doc/git-lsd/alias.txt @@ -0,0 +1 @@ +ls-files --debug diff --git a/doc/git-lsd/description.md b/doc/git-lsd/description.md new file mode 100644 index 0000000..f68cea2 --- /dev/null +++ b/doc/git-lsd/description.md @@ -0,0 +1,7 @@ +List files and show debug information. + +Example: + +```shell +git lsd +``` diff --git a/doc/git-lsd/git-lsd.gitconfig b/doc/git-lsd/git-lsd.gitconfig new file mode 100644 index 0000000..20e9da4 --- /dev/null +++ b/doc/git-lsd/git-lsd.gitconfig @@ -0,0 +1,2 @@ +[alias] + lsd = "ls-files --debug" diff --git a/doc/git-lsfn/alias.txt b/doc/git-lsfn/alias.txt new file mode 100644 index 0000000..bfefbe4 --- /dev/null +++ b/doc/git-lsfn/alias.txt @@ -0,0 +1 @@ +ls-files --full-name diff --git a/doc/git-lsfn/description.md b/doc/git-lsfn/description.md new file mode 100644 index 0000000..4132f5b --- /dev/null +++ b/doc/git-lsfn/description.md @@ -0,0 +1,7 @@ +List files and show full name. + +Example: + +```shell +git lsfn +``` diff --git a/doc/git-lsfn/git-lsfn.gitconfig b/doc/git-lsfn/git-lsfn.gitconfig new file mode 100644 index 0000000..78ee534 --- /dev/null +++ b/doc/git-lsfn/git-lsfn.gitconfig @@ -0,0 +1,2 @@ +[alias] + lsfn = "ls-files --full-name" diff --git a/doc/git-lsio/alias.txt b/doc/git-lsio/alias.txt new file mode 100644 index 0000000..100d433 --- /dev/null +++ b/doc/git-lsio/alias.txt @@ -0,0 +1 @@ +ls-files --ignored --others --exclude-standard diff --git a/doc/git-lsio/description.md b/doc/git-lsio/description.md new file mode 100644 index 0000000..c3f032a --- /dev/null +++ b/doc/git-lsio/description.md @@ -0,0 +1,31 @@ +List files that Git is ignoring. + +Example: + +```shell +git lsio +``` + +### Documentation for `git ls-files` + +
+ +
-i, --ignored
+ +
+Show only ignored files in the output. … +
+ +
-o, --others
+ +
+Show other (i.e. untracked) files in the output. +
+ +
--exclude-standard
+ +
+Add the standard Git exclusions … +
+ +
diff --git a/doc/git-lsio/git-lsio.gitconfig b/doc/git-lsio/git-lsio.gitconfig new file mode 100644 index 0000000..58ce43d --- /dev/null +++ b/doc/git-lsio/git-lsio.gitconfig @@ -0,0 +1,2 @@ +[alias] + lsio = "ls-files --ignored --others --exclude-standard" diff --git a/doc/git-lto/alias.txt b/doc/git-lto/alias.txt new file mode 100644 index 0000000..c7add92 --- /dev/null +++ b/doc/git-lto/alias.txt @@ -0,0 +1 @@ +log --topo-order diff --git a/doc/git-lto/description.md b/doc/git-lto/description.md new file mode 100644 index 0000000..b097ac1 --- /dev/null +++ b/doc/git-lto/description.md @@ -0,0 +1,9 @@ +Log with items appearing in topological order. + +Example: + +```shell +git lto +``` + +Topological order means that descendant commits are shown before their parents. diff --git a/doc/git-lto/git-lto.gitconfig b/doc/git-lto/git-lto.gitconfig new file mode 100644 index 0000000..72e781b --- /dev/null +++ b/doc/git-lto/git-lto.gitconfig @@ -0,0 +1,2 @@ +[alias] + lto = "log --topo-order" diff --git a/doc/git-m/alias.txt b/doc/git-m/alias.txt new file mode 100644 index 0000000..a00af07 --- /dev/null +++ b/doc/git-m/alias.txt @@ -0,0 +1 @@ +merge diff --git a/doc/git-m/description.md b/doc/git-m/description.md new file mode 100644 index 0000000..6387e98 --- /dev/null +++ b/doc/git-m/description.md @@ -0,0 +1,7 @@ +Short for "git merge". + +Example: + +```shell +git m +``` diff --git a/doc/git-m/git-m.gitconfig b/doc/git-m/git-m.gitconfig new file mode 100644 index 0000000..6f44f9e --- /dev/null +++ b/doc/git-m/git-m.gitconfig @@ -0,0 +1,2 @@ +[alias] + m = "merge" diff --git a/doc/git-ma/alias.txt b/doc/git-ma/alias.txt new file mode 100644 index 0000000..36114d4 --- /dev/null +++ b/doc/git-ma/alias.txt @@ -0,0 +1 @@ +merge --abort diff --git a/doc/git-ma/description.md b/doc/git-ma/description.md new file mode 100644 index 0000000..dbc54ba --- /dev/null +++ b/doc/git-ma/description.md @@ -0,0 +1,7 @@ +Merge abort i.e. abort the merge process. + +Example: + +```shell +git ma +``` diff --git a/doc/git-ma/git-ma.gitconfig b/doc/git-ma/git-ma.gitconfig new file mode 100644 index 0000000..e3df382 --- /dev/null +++ b/doc/git-ma/git-ma.gitconfig @@ -0,0 +1,2 @@ +[alias] + ma = "merge --abort" diff --git a/doc/git-mainly/alias.sh b/doc/git-mainly/alias.sh new file mode 100644 index 0000000..a234387 --- /dev/null +++ b/doc/git-mainly/alias.sh @@ -0,0 +1 @@ +git checkout "$(git default-branch)" && git fetch origin --prune && git reset --hard "origin/$(git default-branch)" diff --git a/doc/git-mainly/description.md b/doc/git-mainly/description.md new file mode 100644 index 0000000..db2bec3 --- /dev/null +++ b/doc/git-mainly/description.md @@ -0,0 +1,11 @@ +Make local like main. + +Example: + +```shell +git mainly +``` + +Do everything we can to make the local repo like the main branch. + + diff --git a/doc/git-mc/alias.txt b/doc/git-mc/alias.txt new file mode 100644 index 0000000..9ad5ee7 --- /dev/null +++ b/doc/git-mc/alias.txt @@ -0,0 +1 @@ +merge --continue diff --git a/doc/git-mc/description.md b/doc/git-mc/description.md new file mode 100644 index 0000000..d4182af --- /dev/null +++ b/doc/git-mc/description.md @@ -0,0 +1,7 @@ +Merge continue i.e. continue the merge process. + +Example: + +```shell +git mc +``` diff --git a/doc/git-mc/git-mc.gitconfig b/doc/git-mc/git-mc.gitconfig new file mode 100644 index 0000000..fb7750e --- /dev/null +++ b/doc/git-mc/git-mc.gitconfig @@ -0,0 +1,2 @@ +[alias] + mc = "merge --continue" diff --git a/doc/git-merge-safe/description.md b/doc/git-merge-safe/description.md new file mode 100644 index 0000000..339e2a3 --- /dev/null +++ b/doc/git-merge-safe/description.md @@ -0,0 +1,33 @@ +Join two or more development histories together safely. + +Example: + +```shell +git merge-safe +``` + +### Documentation for `git-merge` + +
+ +
--no-commit
+ +
+Perform the merge and stop just before creating a merge commit, +to give the user a chance to inspect and further tweak the merge +result before committing. + +Note that fast-forward updates do not create a merge commit and +therefore there is no way to stop those merges with --no-commit. +Thus, if you want to ensure your branch is not changed or updated +by the merge command, use --no-commit --no-ff. +
+ +
--no-ff
+ +
+Create a merge commit in all cases, even when the merge could +instead be resolved as a fast-forward. +
+ +
diff --git a/doc/git-merge-span-diff/alias.sh b/doc/git-merge-span-diff/alias.sh new file mode 100644 index 0000000..6c04a98 --- /dev/null +++ b/doc/git-merge-span-diff/alias.sh @@ -0,0 +1 @@ +git diff "$(git merge-span ... "$1")" diff --git a/doc/git-merge-span-diff/description.md b/doc/git-merge-span-diff/description.md new file mode 100644 index 0000000..58efdd8 --- /dev/null +++ b/doc/git-merge-span-diff/description.md @@ -0,0 +1,14 @@ +Show the changes that were introduced by a merge. + +Example: + +```shell +git merge-span-diff +``` + +Compare: + +* [git merge-span](../git-merge-span) (summary) +* [git merge-span-log](../git-merge-span-log) +* [git merge-span-diff](../git-merge-span-diff) (this alias) +* [git merge-span-difftool](../git-merge-span-difftool) diff --git a/doc/git-merge-span-difftool/alias.sh b/doc/git-merge-span-difftool/alias.sh new file mode 100644 index 0000000..3f3f5a9 --- /dev/null +++ b/doc/git-merge-span-difftool/alias.sh @@ -0,0 +1 @@ +git difftool "$(git merge-span ... "$1")" diff --git a/doc/git-merge-span-difftool/description.md b/doc/git-merge-span-difftool/description.md new file mode 100644 index 0000000..5c37e77 --- /dev/null +++ b/doc/git-merge-span-difftool/description.md @@ -0,0 +1,14 @@ +Show the changes that were introduced by a merge, in your difftool. + +Example: + +```shell +git merge-span-difftool +``` + +Compare: + +* [git merge-span](../git-merge-span) (summary) +* [git merge-span-log](../git-merge-span-log) +* [git merge-span-diff](../git-merge-span-diff) +* [git merge-span-difftool](../git-merge-span-difftool) (this alias) diff --git a/doc/git-merge-span-log/alias.sh b/doc/git-merge-span-log/alias.sh new file mode 100644 index 0000000..ea683bd --- /dev/null +++ b/doc/git-merge-span-log/alias.sh @@ -0,0 +1 @@ +git log "$(git merge-span .. "$1")" diff --git a/doc/git-merge-span-log/description.md b/doc/git-merge-span-log/description.md new file mode 100644 index 0000000..ecf0ccd --- /dev/null +++ b/doc/git-merge-span-log/description.md @@ -0,0 +1,14 @@ +Find the commits that were introduced by a merge. + +Example: + +```shell +git merge-span-log +``` + +Compare: + +* [git merge-span](../git-merge-span) (summary) +* [git merge-span-log](../git-merge-span-log) (this alias) +* [git merge-span-diff](../git-merge-span-diff) +* [git merge-span-difftool](../git-merge-span-difftool) diff --git a/doc/git-merge-span/alias.sh b/doc/git-merge-span/alias.sh new file mode 100644 index 0000000..077c721 --- /dev/null +++ b/doc/git-merge-span/alias.sh @@ -0,0 +1 @@ +f() { echo "$(git log -1 "$2" --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 "$2" --merges --pretty=format:%P | cut -d' ' -f2)"; }; f diff --git a/doc/git-merge-span/description.md b/doc/git-merge-span/description.md new file mode 100644 index 0000000..1ddacbc --- /dev/null +++ b/doc/git-merge-span/description.md @@ -0,0 +1,17 @@ +Merge span aliases. + +Example: + +```shell +git merge-span +git merge-span-log +git merge-span-diff +git merge-span-difftool +``` + +Compare: + +* [git merge-span](../git-merge-span) (this page) +* [git merge-span-log](../git-merge-span-log) +* [git merge-span-diff](../git-merge-span-diff) +* [git merge-span-difftool](../git-merge-span-difftool) diff --git a/doc/git-mncnf/alias.txt b/doc/git-mncnf/alias.txt new file mode 100644 index 0000000..d25004b --- /dev/null +++ b/doc/git-mncnf/alias.txt @@ -0,0 +1 @@ +merge --no-commit --no-ff diff --git a/doc/git-mncnf/description.md b/doc/git-mncnf/description.md new file mode 100644 index 0000000..00a9034 --- /dev/null +++ b/doc/git-mncnf/description.md @@ -0,0 +1,9 @@ +Merge with no autocommit, and with no fast-forward. + +Example: + +```shell +git mncnf +``` + +This does a merge, but without autocommit, and with a commit even if the merge resolves as a fast-forward. diff --git a/doc/git-mncnf/git-mncnf.gitconfig b/doc/git-mncnf/git-mncnf.gitconfig new file mode 100644 index 0000000..b756698 --- /dev/null +++ b/doc/git-mncnf/git-mncnf.gitconfig @@ -0,0 +1,2 @@ +[alias] + mncnf = "merge --no-commit --no-ff" diff --git a/doc/git-move-alias/alias.sh b/doc/git-move-alias/alias.sh new file mode 100644 index 0000000..cbbf4b0 --- /dev/null +++ b/doc/git-move-alias/alias.sh @@ -0,0 +1 @@ +f() { if [ $# != 3 ]; then echo "Usage: git move-alias ( --local | --global ) "; echo "Error: this command needs 3 arguments."; return 2; fi; if [ "$2" = "$3" ]; then echo "The alias names are identical, thus no change happened."; return 3; fi; if [ -z "$(git config "$1" --get alias."$2")" ]; then echo "Alias '$2' does not exist, thus no change happened."; return 4; fi; if [ -n "$(git config "$1" --get alias."$3")" ]; then echo "Alias '$3' already exists, thus no change happened."; return 5; fi; git config "$1" alias."$3" "$(git config "$1" --get alias."$2")" && git config "$1" --unset alias."$2" && return 0; echo "Usage: git move-alias ( --local | --global ) "; echo "Error: unknown failure."; return 1; };f diff --git a/doc/git-move-alias/description.md b/doc/git-move-alias/description.md new file mode 100644 index 0000000..95fd8e6 --- /dev/null +++ b/doc/git-move-alias/description.md @@ -0,0 +1,8 @@ +Rename an existing Git alias. + +Example: + +```shell +git move-alias --local foo bar +git move-alias --global foo bar +``` diff --git a/doc/git-o/alias.txt b/doc/git-o/alias.txt new file mode 100644 index 0000000..72c48c6 --- /dev/null +++ b/doc/git-o/alias.txt @@ -0,0 +1 @@ +checkout diff --git a/doc/git-o/description.md b/doc/git-o/description.md new file mode 100644 index 0000000..5f54ddd --- /dev/null +++ b/doc/git-o/description.md @@ -0,0 +1,7 @@ +Short for "git checkout". + +Example: + +```shell +git o +``` diff --git a/doc/git-o/git-o.gitconfig b/doc/git-o/git-o.gitconfig new file mode 100644 index 0000000..84ff707 --- /dev/null +++ b/doc/git-o/git-o.gitconfig @@ -0,0 +1,2 @@ +[alias] + o = "checkout" diff --git a/doc/git-optimizer/alias.sh b/doc/git-optimizer/alias.sh new file mode 100644 index 0000000..fe87865 --- /dev/null +++ b/doc/git-optimizer/alias.sh @@ -0,0 +1 @@ +git pruner diff --git a/doc/git-optimizer/description.md b/doc/git-optimizer/description.md new file mode 100644 index 0000000..2ee222e --- /dev/null +++ b/doc/git-optimizer/description.md @@ -0,0 +1,21 @@ +Optimize a repo our preferred way i.e. by pruning and repacking. + + +Example: + +```shell +git optimizer +``` + +The purpose of this command is to do everything possible +to optimize the repository. + +This command takes a long time to run, perhaps even overnight. + +This command calls our other aliases: + + * [git pruner](../git-pruner) + + * [git repacker](../git-repacker) + +This command also calls `git prune-packed`. This step may be unnecessary. diff --git a/doc/git-orphans/alias.txt b/doc/git-orphans/alias.txt new file mode 100644 index 0000000..f918ea1 --- /dev/null +++ b/doc/git-orphans/alias.txt @@ -0,0 +1 @@ +fsck --full diff --git a/doc/git-orphans/description.md b/doc/git-orphans/description.md new file mode 100644 index 0000000..07acbb2 --- /dev/null +++ b/doc/git-orphans/description.md @@ -0,0 +1,15 @@ +Find all objects that aren't referenced by any other object. + +Example: + +```shell +git orphans +``` + +To help an orphan, we can create a new branch with the orphan's commit hash, +then merge it into our current branch: + +```shell +git branch foo +git merge foo +``` diff --git a/doc/git-orphans/git-orphans.gitconfig b/doc/git-orphans/git-orphans.gitconfig new file mode 100644 index 0000000..cd67f15 --- /dev/null +++ b/doc/git-orphans/git-orphans.gitconfig @@ -0,0 +1,2 @@ +[alias] + orphans = "fsck --full" diff --git a/doc/git-ours-git-theirs/description.md b/doc/git-ours-git-theirs/description.md new file mode 100644 index 0000000..2659ab6 --- /dev/null +++ b/doc/git-ours-git-theirs/description.md @@ -0,0 +1,28 @@ +# git ours & git theirs + +## Easy merging when you know which files you want + +Git alias: + +```git +ours = !"f() { git checkout --ours $@ && git add $@; }; f" +theirs = !"f() { git checkout --theirs $@ && git add $@; }; f" +``` + +Example: + +```shell +git ours +git theirs +``` + +Sometimes during a merge you want to take a file from one side wholesale. + +The following aliases expose the "ours" and "theirs" options which let you +pick a file(s) from the current branch or the merged branch respectively. + +Compare: + +* [git ours](../git-ours) - Checkout our version of a file and add it + +* [git theirs](../git-theirs) - Checkout their version of a file and add it diff --git a/doc/git-ours/alias.sh b/doc/git-ours/alias.sh new file mode 100644 index 0000000..badd4e7 --- /dev/null +++ b/doc/git-ours/alias.sh @@ -0,0 +1 @@ +f() { git checkout --ours "$@" && git add "$@"; }; f diff --git a/doc/git-ours/description.md b/doc/git-ours/description.md new file mode 100644 index 0000000..d37fc38 --- /dev/null +++ b/doc/git-ours/description.md @@ -0,0 +1,15 @@ +Checkout our version of a file and add it. + +Example: + +```shell +git ours +``` + +Compare: + +* [git ours & git theirs](../git-ours-git-theirs) (describes both) + +* [git ours](../git-ours) (this alias) + +* [git theirs](../git-theirs) diff --git a/doc/git-outbound/alias.txt b/doc/git-outbound/alias.txt new file mode 100644 index 0000000..b17ce34 --- /dev/null +++ b/doc/git-outbound/alias.txt @@ -0,0 +1 @@ +log @{upstream}.. diff --git a/doc/git-outbound/description.md b/doc/git-outbound/description.md new file mode 100644 index 0000000..ed3c858 --- /dev/null +++ b/doc/git-outbound/description.md @@ -0,0 +1,9 @@ +Show outgoing changes compared to upstream. + +Example: + +```shell +git outbound +``` + +Compare [git inbound](../git-inbound). diff --git a/doc/git-outbound/git-outbound.gitconfig b/doc/git-outbound/git-outbound.gitconfig new file mode 100644 index 0000000..093fa4a --- /dev/null +++ b/doc/git-outbound/git-outbound.gitconfig @@ -0,0 +1,2 @@ +[alias] + outbound = "log @{upstream}.." diff --git a/doc/git-p/alias.txt b/doc/git-p/alias.txt new file mode 100644 index 0000000..78a4bc3 --- /dev/null +++ b/doc/git-p/alias.txt @@ -0,0 +1 @@ +pull diff --git a/doc/git-p/description.md b/doc/git-p/description.md new file mode 100644 index 0000000..66faba0 --- /dev/null +++ b/doc/git-p/description.md @@ -0,0 +1,7 @@ +Short for `git pull`. + +Example: + +```shell +git p +``` diff --git a/doc/git-p/git-p.gitconfig b/doc/git-p/git-p.gitconfig new file mode 100644 index 0000000..4b52186 --- /dev/null +++ b/doc/git-p/git-p.gitconfig @@ -0,0 +1,2 @@ +[alias] + p = "pull" diff --git a/doc/git-panic/alias.sh b/doc/git-panic/alias.sh new file mode 100644 index 0000000..0792279 --- /dev/null +++ b/doc/git-panic/alias.sh @@ -0,0 +1 @@ +tar cvf ../panic.tar -- * diff --git a/doc/git-panic/description.md b/doc/git-panic/description.md new file mode 100644 index 0000000..3cb6a18 --- /dev/null +++ b/doc/git-panic/description.md @@ -0,0 +1,9 @@ +When you're a little worried that the world is coming to an end. + +Example: + +```shell +git panic +``` + +This alias creates an archive of the entire repo. diff --git a/doc/git-pf/alias.txt b/doc/git-pf/alias.txt new file mode 100644 index 0000000..fba97a8 --- /dev/null +++ b/doc/git-pf/alias.txt @@ -0,0 +1 @@ +pull --ff-only diff --git a/doc/git-pf/description.md b/doc/git-pf/description.md new file mode 100644 index 0000000..9728263 --- /dev/null +++ b/doc/git-pf/description.md @@ -0,0 +1,7 @@ +Pull if a merge can be resolved as a fast-forward, otherwise fail. + +Example: + +```shell +git pf +``` diff --git a/doc/git-pf/git-pf.gitconfig b/doc/git-pf/git-pf.gitconfig new file mode 100644 index 0000000..b1418c8 --- /dev/null +++ b/doc/git-pf/git-pf.gitconfig @@ -0,0 +1,2 @@ +[alias] + pf = "pull --ff-only" diff --git a/doc/git-pr/alias.txt b/doc/git-pr/alias.txt new file mode 100644 index 0000000..ee8f08a --- /dev/null +++ b/doc/git-pr/alias.txt @@ -0,0 +1 @@ +pull --rebase diff --git a/doc/git-pr/description.md b/doc/git-pr/description.md new file mode 100644 index 0000000..3db5d55 --- /dev/null +++ b/doc/git-pr/description.md @@ -0,0 +1,47 @@ +Pull with rebase i.e. provide a cleaner, linear, bisectable history. + +Example: + +```shell +git pr +``` + +To automatically do "pull --rebase" everywhere: + +```shell +git config --global pull.rebase true +``` + +To automatically do "pull --rebase" for any branch based on +the branch "main": + +```shell +git config branch.main.rebase true +``` + +To automatically do "pull --rebase" for any newly-created branches: + +```shell +git config --global branch.autosetuprebase always +``` + +To integrate changes between branches, you can merge or rebase. + +When we use "git pull", then git does a fetch then a merge. + +If we've made changes locally and someone else has pushed changes +to our git host then git will automatically merge these together +and create a merge commit that looks like this in the history: + +```shell +12345678 - Merge branch 'foo' of bar into main +``` + +When we use "git pull --rebase", then git does a fetch then a rebase. + +A rebase resets the HEAD of your local branch to be the same as +the remote HEAD, then replays your local commits back into repo. + +This means you don't get any noisy merge messages in your history. + +This gives us a linear history, and also helps with git bisect. diff --git a/doc/git-pr/git-pr.gitconfig b/doc/git-pr/git-pr.gitconfig new file mode 100644 index 0000000..1d4b0f7 --- /dev/null +++ b/doc/git-pr/git-pr.gitconfig @@ -0,0 +1,2 @@ +[alias] + pr = "pull --rebase" diff --git a/doc/git-prp/alias.txt b/doc/git-prp/alias.txt new file mode 100644 index 0000000..e564d3d --- /dev/null +++ b/doc/git-prp/alias.txt @@ -0,0 +1 @@ +pull --rebase=preserve diff --git a/doc/git-prp/description.md b/doc/git-prp/description.md new file mode 100644 index 0000000..42cc670 --- /dev/null +++ b/doc/git-prp/description.md @@ -0,0 +1,45 @@ +Pull with rebase preserve of merge commits. + +Example: + +```shell +git prp +``` + +See + +You should only rebase if you know (in a sort of general sense) +what you are doing, and if you do know what you are doing, then you +would probably prefer a merge-preserving rebase as a general rule. + +Although by the time you've decided that rebasing is a good idea, +you will probably find that a history that has its own embedded +branch-and-merge-points is not necessarily the correct "final +rewritten history". + +That is, if it's appropriate to do a rebase at all, it's at least fairly +likely that the history to be rebased is itself linear, so that the +preserve-vs-flatten question is moot anyway. + +See + +While preserving merges is probably generally superior, in at least a +few ways, to discarding them when rebasing, the fact is that rebase +cannot preserve them. The only thing it can do, once some commits +have been copied to new commits, is re-perform them. This can have new +and/or different merge conflicts, vs the last time the merge was done. +You should also pay close attention to the restrictions on merge +preservation in the git rebase documentation. + +Without getting into a lot of detail, it always seems to me that most +commit graph subsets that "should be" rebased, rarely have any +internal merges. If such a graph subset has a single final merge, you +can simply strip away that merge (with git reset) before rebasing, +and re-do that single merge manually at the end. (In fact, git rebase +normally drops merge commits entirely, so you don't have to run the git +reset itself in some cases. The one where you do have to run it is when +the merge is into the branch onto which you intend to rebase. This is +where git pull actually does the right thing when it uses +`git rebase -p`, except that it fails to check for, and warn about, +internal merges, which are sort of warning signs that rebasing might +not be a good idea. diff --git a/doc/git-prp/git-prp.gitconfig b/doc/git-prp/git-prp.gitconfig new file mode 100644 index 0000000..3f7a976 --- /dev/null +++ b/doc/git-prp/git-prp.gitconfig @@ -0,0 +1,2 @@ +[alias] + prp = "pull --rebase=preserve" diff --git a/doc/git-pruner/alias.sh b/doc/git-pruner/alias.sh new file mode 100644 index 0000000..579d593 --- /dev/null +++ b/doc/git-pruner/alias.sh @@ -0,0 +1 @@ +git prune --expire=now; git reflog expire --expire-unreachable=now --rewrite --all diff --git a/doc/git-pruner/description.md b/doc/git-pruner/description.md new file mode 100644 index 0000000..6198609 --- /dev/null +++ b/doc/git-pruner/description.md @@ -0,0 +1,13 @@ +Prune using our recommnded way i.e. prune everything unreachable now. + +Example: + +```shell +git pruner +``` + +This command takes a long time to run, perhaps even overnight. + +This is useful for removing unreachable objects from all places. + +By [CodeGnome](http://www.codegnome.com/) diff --git a/doc/git-publish-git-unpublish/description.md b/doc/git-publish-git-unpublish/description.md new file mode 100644 index 0000000..9942543 --- /dev/null +++ b/doc/git-publish-git-unpublish/description.md @@ -0,0 +1,8 @@ +# git publish & git unpublish + +## Publish/unpublish the current branch + +Compare: + +* [git publish](../git-publish) +* [git unpublish](../git-unpublish) diff --git a/doc/git-publish/alias.sh b/doc/git-publish/alias.sh new file mode 100644 index 0000000..0879c08 --- /dev/null +++ b/doc/git-publish/alias.sh @@ -0,0 +1 @@ +git push --set-upstream origin "$(git current-branch)" diff --git a/doc/git-publish/description.md b/doc/git-publish/description.md new file mode 100644 index 0000000..608db27 --- /dev/null +++ b/doc/git-publish/description.md @@ -0,0 +1,18 @@ +Publish the current branch. + +Publish the current branch by pushing upstream to origin, +and setting the current branch to track the upstream branch. + +Example: + +```shell +git publish +``` + +Compare: + +* [git publish & git unpublish](../git-publish-git-unpublish) (describes both) + +* [git publish](../git-publish) (this alias) + +* [git unpublish](../git-unpublish) diff --git a/doc/git-pull1/alias.sh b/doc/git-pull1/alias.sh new file mode 100644 index 0000000..8ff7dae --- /dev/null +++ b/doc/git-pull1/alias.sh @@ -0,0 +1 @@ +git pull origin "$(git current-branch)" diff --git a/doc/git-pull1/description.md b/doc/git-pull1/description.md new file mode 100644 index 0000000..1420e2f --- /dev/null +++ b/doc/git-pull1/description.md @@ -0,0 +1,9 @@ +Pull just the one current branch. + +Example: + +```shell +git pull1 +``` + +Compare [git push1](../git-push1). diff --git a/doc/git-push1/alias.sh b/doc/git-push1/alias.sh new file mode 100644 index 0000000..3d9bcac --- /dev/null +++ b/doc/git-push1/alias.sh @@ -0,0 +1 @@ +git push origin "$(git current-branch)" diff --git a/doc/git-push1/description.md b/doc/git-push1/description.md new file mode 100644 index 0000000..81bfb56 --- /dev/null +++ b/doc/git-push1/description.md @@ -0,0 +1,9 @@ +Push just the one current branch. + +Example: + +```shell +git push1 +``` + +Compare [git pull1](../git-pull1). diff --git a/doc/git-pushy/alias.sh b/doc/git-pushy/alias.sh new file mode 100644 index 0000000..1b85e03 --- /dev/null +++ b/doc/git-pushy/alias.sh @@ -0,0 +1 @@ +git push --force-with-lease diff --git a/doc/git-pushy/description.md b/doc/git-pushy/description.md new file mode 100644 index 0000000..6c6e113 --- /dev/null +++ b/doc/git-pushy/description.md @@ -0,0 +1,14 @@ +Push with force and lease. + +Push with force and lease, which means that you're pushing in order +to forcefully overwrite the remote, and you want a safety check first: +git checks you're current with remote, and only then allows the push. + +We name this `pushy` because its dsagreeably aggressive (in general) +or overly assertive (in general), yet still better than just --force. + +Example: + +````shell +git pushy +``` diff --git a/doc/git-put/alias.sh b/doc/git-put/alias.sh new file mode 100644 index 0000000..2ac5796 --- /dev/null +++ b/doc/git-put/alias.sh @@ -0,0 +1 @@ +git commit --all && git push diff --git a/doc/git-put/description.md b/doc/git-put/description.md new file mode 100644 index 0000000..cfd65d3 --- /dev/null +++ b/doc/git-put/description.md @@ -0,0 +1,12 @@ +Put all changes for the current branch. + +Example: + +```shell +git put +``` + +Compare: +* [git get & git put](../git-get-git-put) (describes both) +* [git get](../git-get) +* [git put](../git-put) (this alias) diff --git a/doc/git-rb/alias.txt b/doc/git-rb/alias.txt new file mode 100644 index 0000000..97ef86e --- /dev/null +++ b/doc/git-rb/alias.txt @@ -0,0 +1 @@ +rebase diff --git a/doc/git-rb/description.md b/doc/git-rb/description.md new file mode 100644 index 0000000..7114088 --- /dev/null +++ b/doc/git-rb/description.md @@ -0,0 +1,7 @@ +Short for "git rebase". + +Example: + +```shell +git rb +``` diff --git a/doc/git-rb/git-rb.gitconfig b/doc/git-rb/git-rb.gitconfig new file mode 100644 index 0000000..c7d9450 --- /dev/null +++ b/doc/git-rb/git-rb.gitconfig @@ -0,0 +1,2 @@ +[alias] + rb = "rebase" diff --git a/doc/git-rba/alias.txt b/doc/git-rba/alias.txt new file mode 100644 index 0000000..2c698e7 --- /dev/null +++ b/doc/git-rba/alias.txt @@ -0,0 +1 @@ +rebase --abort diff --git a/doc/git-rba/description.md b/doc/git-rba/description.md new file mode 100644 index 0000000..28d7eed --- /dev/null +++ b/doc/git-rba/description.md @@ -0,0 +1,7 @@ +Rebase abort i.e. abort the rebase process. + +Example: + +```shell +git rba +``` diff --git a/doc/git-rba/git-rba.gitconfig b/doc/git-rba/git-rba.gitconfig new file mode 100644 index 0000000..ed05ed6 --- /dev/null +++ b/doc/git-rba/git-rba.gitconfig @@ -0,0 +1,2 @@ +[alias] + rba = "rebase --abort" diff --git a/doc/git-rbc/alias.txt b/doc/git-rbc/alias.txt new file mode 100644 index 0000000..21c60c4 --- /dev/null +++ b/doc/git-rbc/alias.txt @@ -0,0 +1 @@ +rebase --continue diff --git a/doc/git-rbc/description.md b/doc/git-rbc/description.md new file mode 100644 index 0000000..49a918d --- /dev/null +++ b/doc/git-rbc/description.md @@ -0,0 +1,9 @@ +Rebase continue i.e. continue the rebase process. + +Example: + +```shell +git rbc +``` + +Continue after resolving a conflict and updating the index. diff --git a/doc/git-rbc/git-rbc.gitconfig b/doc/git-rbc/git-rbc.gitconfig new file mode 100644 index 0000000..38acb07 --- /dev/null +++ b/doc/git-rbc/git-rbc.gitconfig @@ -0,0 +1,2 @@ +[alias] + rbc = "rebase --continue" diff --git a/doc/git-rbi/alias.txt b/doc/git-rbi/alias.txt new file mode 100644 index 0000000..aabe299 --- /dev/null +++ b/doc/git-rbi/alias.txt @@ -0,0 +1 @@ +rebase --interactive diff --git a/doc/git-rbi/description.md b/doc/git-rbi/description.md new file mode 100644 index 0000000..0f12561 --- /dev/null +++ b/doc/git-rbi/description.md @@ -0,0 +1,7 @@ +Rebase interactive i.e. do a rebase with prompts. + +Example: + +```shell +git rbi +``` diff --git a/doc/git-rbi/git-rbi.gitconfig b/doc/git-rbi/git-rbi.gitconfig new file mode 100644 index 0000000..c4ab730 --- /dev/null +++ b/doc/git-rbi/git-rbi.gitconfig @@ -0,0 +1,2 @@ +[alias] + rbi = "rebase --interactive" diff --git a/doc/git-rbiu/alias.txt b/doc/git-rbiu/alias.txt new file mode 100644 index 0000000..5bb7ee8 --- /dev/null +++ b/doc/git-rbiu/alias.txt @@ -0,0 +1 @@ +rebase --interactive @{upstream} diff --git a/doc/git-rbiu/description.md b/doc/git-rbiu/description.md new file mode 100644 index 0000000..ac8d251 --- /dev/null +++ b/doc/git-rbiu/description.md @@ -0,0 +1,42 @@ +Rebase interactive on unpushed commits. + +Example: + +```shell +git rbiu +``` + +Before we push our local changes, we may want to do some cleanup, +to improve our commit messages or squash related commits together. + +Let's say I've pushed two commits that are related to a new feature and +I have another where I made a spelling mistake in the commit message. + +When I run "git rbiu" I get dropped into my editor with this: + +```shell +pick 7f06d36 foo +pick ad544d0 goo +pick de3083a hoo +``` + +Let's say I want to squash the "foo" and "goo" commits together, +and also change "hoo" to say "whatever". To do these, I change "pick" +to say "s" for squash; this tells git to squash the two together; +I also edit "hoo" to rename it to "whatever". + +I make the file look like this: + +```shell +pick 7f06d36 foo +s ad544d0 goo +r de3083a whatever + +This gives me two new commit messages to edit, which I update. + +Now when I push the remote repo host receives two commits: + +```shell +3400455 - foo +5dae0a0 - whatever +``` diff --git a/doc/git-rbiu/git-rbiu.gitconfig b/doc/git-rbiu/git-rbiu.gitconfig new file mode 100644 index 0000000..b43bcd9 --- /dev/null +++ b/doc/git-rbiu/git-rbiu.gitconfig @@ -0,0 +1,2 @@ +[alias] + rbiu = "rebase --interactive @{upstream}" diff --git a/doc/git-rbs/alias.txt b/doc/git-rbs/alias.txt new file mode 100644 index 0000000..47fe084 --- /dev/null +++ b/doc/git-rbs/alias.txt @@ -0,0 +1 @@ +rebase --skip diff --git a/doc/git-rbs/description.md b/doc/git-rbs/description.md new file mode 100644 index 0000000..7aa4132 --- /dev/null +++ b/doc/git-rbs/description.md @@ -0,0 +1,7 @@ +Rebase skip i.e. restart the rebase process by skipping the current patch. + +Example: + +```shell +git rbs +``` diff --git a/doc/git-rbs/git-rbs.gitconfig b/doc/git-rbs/git-rbs.gitconfig new file mode 100644 index 0000000..ab6a604 --- /dev/null +++ b/doc/git-rbs/git-rbs.gitconfig @@ -0,0 +1,2 @@ +[alias] + rbs = "rebase --skip" diff --git a/doc/git-rebase-branch/alias.sh b/doc/git-rebase-branch/alias.sh new file mode 100644 index 0000000..3eb4712 --- /dev/null +++ b/doc/git-rebase-branch/alias.sh @@ -0,0 +1 @@ +f() { git rebase --interactive "$(git merge-base "$(git default-branch)") HEAD)"; }; f diff --git a/doc/git-rebase-branch/description.md b/doc/git-rebase-branch/description.md new file mode 100644 index 0000000..3ce1a24 --- /dev/null +++ b/doc/git-rebase-branch/description.md @@ -0,0 +1,7 @@ +Interactively rebase all the commits on the current branch. + +Example: + +```shell +git rebase-branch +``` diff --git a/doc/git-rebase-interactive-branch/description.md b/doc/git-rebase-interactive-branch/description.md new file mode 100644 index 0000000..eeacc86 --- /dev/null +++ b/doc/git-rebase-interactive-branch/description.md @@ -0,0 +1,7 @@ +Rebase interactive on all the commits on the current branch. + +Example: + +```shell +git rebase-interactive-branch +``` diff --git a/doc/git-rebase-recent/alias.sh b/doc/git-rebase-recent/alias.sh new file mode 100644 index 0000000..9e69fb6 --- /dev/null +++ b/doc/git-rebase-recent/alias.sh @@ -0,0 +1 @@ +git rebase --interactive "$(git remote-ref)" diff --git a/doc/git-rebase-recent/description.md b/doc/git-rebase-recent/description.md new file mode 100644 index 0000000..79f1f36 --- /dev/null +++ b/doc/git-rebase-recent/description.md @@ -0,0 +1,9 @@ +Rebase recent commits with interactive. + +Example: + +```shell +git rebase-recent +``` + +Thanks to jtolds on stackoverflow. diff --git a/doc/git-refs-by-date/alias.txt b/doc/git-refs-by-date/alias.txt new file mode 100644 index 0000000..299ae29 --- /dev/null +++ b/doc/git-refs-by-date/alias.txt @@ -0,0 +1 @@ +for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) (objectname:short) %(contents:subject)' diff --git a/doc/git-refs-by-date/description.md b/doc/git-refs-by-date/description.md new file mode 100644 index 0000000..15512cf --- /dev/null +++ b/doc/git-refs-by-date/description.md @@ -0,0 +1,9 @@ +Show refs sorted by date for branches. + +Example: + +```shell +git refs-by-date +``` + +This alias can be useful for spring cleaning. diff --git a/doc/git-refs-by-date/git-refs-by-date.gitconfig b/doc/git-refs-by-date/git-refs-by-date.gitconfig new file mode 100644 index 0000000..4f30f0b --- /dev/null +++ b/doc/git-refs-by-date/git-refs-by-date.gitconfig @@ -0,0 +1,2 @@ +[alias] + refs-by-date = "for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) (objectname:short) %(contents:subject)'" diff --git a/doc/git-reincarnate/alias.sh b/doc/git-reincarnate/alias.sh new file mode 100644 index 0000000..e02c6c4 --- /dev/null +++ b/doc/git-reincarnate/alias.sh @@ -0,0 +1 @@ +f() { [ $# -gt 0 ] && git checkout "$1" && git unpublish && git checkout main && git branch -D "$1" && git checkout -b "$1" && git publish; }; f diff --git a/doc/git-reincarnate/description.md b/doc/git-reincarnate/description.md new file mode 100644 index 0000000..448beb4 --- /dev/null +++ b/doc/git-reincarnate/description.md @@ -0,0 +1,14 @@ +Delete a branch then create it anew. + +Example: + +```shell +git reincarnate +``` + +This can useful if you have, for example, a development branch and +a main branch, and they are accidentally out of sync, and you want +to nuke the development branch, and start over with a fresh branch. + +This implementation calls the `publish` and `unpublish` aliases, +and uses the `main` branch name; you could/should customize these. diff --git a/doc/git-remote-ref/alias.sh b/doc/git-remote-ref/alias.sh new file mode 100644 index 0000000..83e3d6b --- /dev/null +++ b/doc/git-remote-ref/alias.sh @@ -0,0 +1 @@ + local_ref="$(git symbolic-ref HEAD)"; local_name="${local_ref##refs/heads/}"; remote="$(git config branch."#local_name".remote || echo origin)"; remote_ref="$(git config branch."$local_name".merge)"; remote_name="${remote_ref##refs/heads/}"; echo "remotes/$remote/$remote_name" # diff --git a/doc/git-remote-ref/description.md b/doc/git-remote-ref/description.md new file mode 100644 index 0000000..7411eab --- /dev/null +++ b/doc/git-remote-ref/description.md @@ -0,0 +1,7 @@ +Example: + +```shell +git remote-ref +``` + +Thanks to jtolds on stackoverflow diff --git a/doc/git-remotes-prune/alias.sh b/doc/git-remotes-prune/alias.sh new file mode 100644 index 0000000..dd01001 --- /dev/null +++ b/doc/git-remotes-prune/alias.sh @@ -0,0 +1 @@ +git remote | xargs -n 1 git remote prune diff --git a/doc/git-remotes-prune/description.md b/doc/git-remotes-prune/description.md new file mode 100644 index 0000000..996439f --- /dev/null +++ b/doc/git-remotes-prune/description.md @@ -0,0 +1,12 @@ +For each remote branch, prune it. + +Example: + +```shell +git remotes-prune +``` + +There's no way to tell `git remote update` to prune stale branches, +and `git remote prune` does not currently understand `--all`. + +So this shell command gets all remotes, and for each one, prunes it. diff --git a/doc/git-remotes-push/alias.sh b/doc/git-remotes-push/alias.sh new file mode 100644 index 0000000..b364cd5 --- /dev/null +++ b/doc/git-remotes-push/alias.sh @@ -0,0 +1 @@ +git remote | xargs -I% -n1 git push % diff --git a/doc/git-remotes-push/description.md b/doc/git-remotes-push/description.md new file mode 100644 index 0000000..45da7e0 --- /dev/null +++ b/doc/git-remotes-push/description.md @@ -0,0 +1,7 @@ +For each remote branch, push it. + +Example: + +```shell +git remotes-push +``` diff --git a/doc/git-repacker/alias.txt b/doc/git-repacker/alias.txt new file mode 100644 index 0000000..67f6732 --- /dev/null +++ b/doc/git-repacker/alias.txt @@ -0,0 +1 @@ +repack -a -d -f --depth=300 --window=300 --window-memory=1g diff --git a/doc/git-repacker/description.md b/doc/git-repacker/description.md new file mode 100644 index 0000000..b42b488 --- /dev/null +++ b/doc/git-repacker/description.md @@ -0,0 +1,36 @@ +Repack a repo using our recommended way i.e. as Linus Torvalds describes. + +Example: + +```shell +git repacker +``` + +This command takes a long time to run, perhaps even overnight. + +It does the equivalent of "git gc --aggressive" +but done *properly*, which is to do something like: + +```shell +git repack -a -d --depth=250 --window=250 +``` + +The depth setting is about how deep the delta chains can be; +make them longer for old history - it's worth the space overhead. + +The window setting is about how big an object window we want +each delta candidate to scan. + +And here, you might well want to add the "-f" flag (which is +the "drop all old deltas", since you now are actually trying +to make sure that this one actually finds good candidates. + +And then it's going to take forever and a day (ie a "do it overnight" +thing). But the end result is that everybody downstream from that +repository will get much better packs, without having to spend any effort +on it themselves. + +http://metalinguist.wordpress.com/2007/12/06/the-woes-of-git-gc-aggressive-and-how-git-deltas-work/ + +We also add the --window-memory limit of 1 gig, which helps protect +us from a window that has very large objects such as binary blobs. diff --git a/doc/git-repacker/git-repacker.gitconfig b/doc/git-repacker/git-repacker.gitconfig new file mode 100644 index 0000000..be5486b --- /dev/null +++ b/doc/git-repacker/git-repacker.gitconfig @@ -0,0 +1,2 @@ +[alias] + repacker = "repack -a -d -f --depth=300 --window=300 --window-memory=1g" diff --git a/doc/git-reset-commit-hard-clean/alias.sh b/doc/git-reset-commit-hard-clean/alias.sh new file mode 100644 index 0000000..d607f23 --- /dev/null +++ b/doc/git-reset-commit-hard-clean/alias.sh @@ -0,0 +1 @@ +git reset --hard HEAD~1 && git clean -fd diff --git a/doc/git-reset-commit-hard-clean/description.md b/doc/git-reset-commit-hard-clean/description.md new file mode 100644 index 0000000..98d111a --- /dev/null +++ b/doc/git-reset-commit-hard-clean/description.md @@ -0,0 +1,12 @@ +Move backwards on the commit chain. + +Example: + +```shell +git reset-commit-hard-clean +``` + +See how to use this alias and related ones: + +* [git reset-*](../git-reset) +* [git undo-*](../git-undo) diff --git a/doc/git-reset-commit-hard/alias.txt b/doc/git-reset-commit-hard/alias.txt new file mode 100644 index 0000000..f4a1930 --- /dev/null +++ b/doc/git-reset-commit-hard/alias.txt @@ -0,0 +1 @@ +reset --hard HEAD~1 diff --git a/doc/git-reset-commit-hard/description.md b/doc/git-reset-commit-hard/description.md new file mode 100644 index 0000000..587cf3e --- /dev/null +++ b/doc/git-reset-commit-hard/description.md @@ -0,0 +1,12 @@ +Move backwards on the commit chain. + +Example: + +```shell +git reset-commit-hard +``` + +See how to use this alias and related ones: + +* [git reset-*](../git-reset) +* [git undo-*](../git-undo) diff --git a/doc/git-reset-commit-hard/git-reset-commit-hard.gitconfig b/doc/git-reset-commit-hard/git-reset-commit-hard.gitconfig new file mode 100644 index 0000000..ce61684 --- /dev/null +++ b/doc/git-reset-commit-hard/git-reset-commit-hard.gitconfig @@ -0,0 +1,2 @@ +[alias] + reset-commit-hard = "reset --hard HEAD~1" diff --git a/doc/git-reset-commit/alias.txt b/doc/git-reset-commit/alias.txt new file mode 100644 index 0000000..3e7d654 --- /dev/null +++ b/doc/git-reset-commit/alias.txt @@ -0,0 +1 @@ +reset --soft HEAD~1 diff --git a/doc/git-reset-commit/description.md b/doc/git-reset-commit/description.md new file mode 100644 index 0000000..59b7876 --- /dev/null +++ b/doc/git-reset-commit/description.md @@ -0,0 +1,12 @@ +Move backwards on the commit chain. + +Example: + +```shell +git reset-commit +``` + +See how to use this alias and related ones: + +* [git reset-*](../git-reset) +* [git undo-*](../git-undo) diff --git a/doc/git-reset-commit/git-reset-commit.gitconfig b/doc/git-reset-commit/git-reset-commit.gitconfig new file mode 100644 index 0000000..996bf65 --- /dev/null +++ b/doc/git-reset-commit/git-reset-commit.gitconfig @@ -0,0 +1,2 @@ +[alias] + reset-commit = "reset --soft HEAD~1" diff --git a/doc/git-reset-to-pristine/alias.sh b/doc/git-reset-to-pristine/alias.sh new file mode 100644 index 0000000..64e9766 --- /dev/null +++ b/doc/git-reset-to-pristine/alias.sh @@ -0,0 +1 @@ +git reset --hard && git clean -ffdx diff --git a/doc/git-reset-to-pristine/description.md b/doc/git-reset-to-pristine/description.md new file mode 100644 index 0000000..672c3b1 --- /dev/null +++ b/doc/git-reset-to-pristine/description.md @@ -0,0 +1,12 @@ +Reset commits and clean all differences + +Example: + +```shell +git reset-to-pristine +``` + +See how to use this alias and related ones: + +* [git reset-*](../git-reset) +* [git undo-*](../git-undo) diff --git a/doc/git-reset-to-upstream/alias.sh b/doc/git-reset-to-upstream/alias.sh new file mode 100644 index 0000000..392e574 --- /dev/null +++ b/doc/git-reset-to-upstream/alias.sh @@ -0,0 +1 @@ +git reset --hard "$(git upstream-branch)" diff --git a/doc/git-reset-to-upstream/description.md b/doc/git-reset-to-upstream/description.md new file mode 100644 index 0000000..dacba99 --- /dev/null +++ b/doc/git-reset-to-upstream/description.md @@ -0,0 +1,12 @@ +Reset commits back to the upstream branch. + +Example: + +```shell +git reset-to-upstream +``` + +See how to use this alias and related ones: + +* [git reset-*](../git-reset) +* [git undo-*](../git-undo) diff --git a/doc/git-reset/description.md b/doc/git-reset/description.md new file mode 100644 index 0000000..f77e288 --- /dev/null +++ b/doc/git-reset/description.md @@ -0,0 +1,28 @@ +# git reset-* + +## Move backwards on the commit chain + +Git alias: + +```git +reset-commit = reset --soft HEAD~1 +reset-commit-hard = reset --hard HEAD~1 +reset-commit-hard-clean = !git reset --hard HEAD~1 && git clean -df +reset-to-pristine = !git reset --hard && git clean -dffx +reset-to-upstream = !git reset --hard $(git upstream-branch) +``` + +Example: + +```shell +git reset-commit +git reset-commit-hard +git reset-commit-hard-clean +git reset-to-pristine +git reset-to-upstrea +``` + +These aliases are intentionally identical to the [git undo-*](../git-undo) aliases. + +This is because, in our experience, novices tend to prefer the word "undo" +whereas experts tend to prefer the word "reset". diff --git a/doc/git-rev-list-all-objects-by-size-and-name/alias.sh b/doc/git-rev-list-all-objects-by-size-and-name/alias.sh new file mode 100644 index 0000000..6407071 --- /dev/null +++ b/doc/git-rev-list-all-objects-by-size-and-name/alias.sh @@ -0,0 +1 @@ +git rev-list --all --objects | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '/^blob/ {print substr($0,6)}' | sort --numeric-sort --key=2 diff --git a/doc/git-rev-list-all-objects-by-size-and-name/description.md b/doc/git-rev-list-all-objects-by-size-and-name/description.md new file mode 100644 index 0000000..29225eb --- /dev/null +++ b/doc/git-rev-list-all-objects-by-size-and-name/description.md @@ -0,0 +1,9 @@ +List all objects by size in bytes and file name. + +Example: + +```shell +git rev-list-all-objects-by-size-and-name +``` + +By [raphinesse](https://stackoverflow.com/users/380229/raphinesse) diff --git a/doc/git-rev-list-all-objects-by-size/alias.sh b/doc/git-rev-list-all-objects-by-size/alias.sh new file mode 100644 index 0000000..1d6ef99 --- /dev/null +++ b/doc/git-rev-list-all-objects-by-size/alias.sh @@ -0,0 +1 @@ +git rev-list --all --objects | awk '{print $1}'| git cat-file --batch-check | grep -F blob | sort -k3nr diff --git a/doc/git-rev-list-all-objects-by-size/description.md b/doc/git-rev-list-all-objects-by-size/description.md new file mode 100644 index 0000000..c51a1ce --- /dev/null +++ b/doc/git-rev-list-all-objects-by-size/description.md @@ -0,0 +1,9 @@ +List all blobs by size in bytes. + +Example: + +```shell +git rev-list-all-objects-by-size +``` + +By [CodeGnome](http://www.codegnome.com/) diff --git a/doc/git-rl/alias.txt b/doc/git-rl/alias.txt new file mode 100644 index 0000000..ce4db97 --- /dev/null +++ b/doc/git-rl/alias.txt @@ -0,0 +1 @@ +reflog diff --git a/doc/git-rl/description.md b/doc/git-rl/description.md new file mode 100644 index 0000000..4ce83c7 --- /dev/null +++ b/doc/git-rl/description.md @@ -0,0 +1,9 @@ +Short for "git reflog". + +Example: + +```shell +git rl +``` + +Reflog is a reference log that manages when tips of branches are updated. diff --git a/doc/git-rl/git-rl.gitconfig b/doc/git-rl/git-rl.gitconfig new file mode 100644 index 0000000..b3ca8ec --- /dev/null +++ b/doc/git-rl/git-rl.gitconfig @@ -0,0 +1,2 @@ +[alias] + rl = "reflog" diff --git a/doc/git-rr/alias.txt b/doc/git-rr/alias.txt new file mode 100644 index 0000000..9c998f7 --- /dev/null +++ b/doc/git-rr/alias.txt @@ -0,0 +1 @@ +remote diff --git a/doc/git-rr/description.md b/doc/git-rr/description.md new file mode 100644 index 0000000..b2fcf2c --- /dev/null +++ b/doc/git-rr/description.md @@ -0,0 +1,7 @@ +Short for "git remote". + +Example: + +```shell +git rr +``` diff --git a/doc/git-rr/git-rr.gitconfig b/doc/git-rr/git-rr.gitconfig new file mode 100644 index 0000000..57d5c1e --- /dev/null +++ b/doc/git-rr/git-rr.gitconfig @@ -0,0 +1,2 @@ +[alias] + rr = "remote" diff --git a/doc/git-rrp/alias.txt b/doc/git-rrp/alias.txt new file mode 100644 index 0000000..a98cded --- /dev/null +++ b/doc/git-rrp/alias.txt @@ -0,0 +1 @@ +remote prune diff --git a/doc/git-rrp/description.md b/doc/git-rrp/description.md new file mode 100644 index 0000000..845039e --- /dev/null +++ b/doc/git-rrp/description.md @@ -0,0 +1,7 @@ +Remote prune i.e. delete all stale remote-tracking branches under . + +Example: + +```shell +git rrp +``` diff --git a/doc/git-rrp/git-rrp.gitconfig b/doc/git-rrp/git-rrp.gitconfig new file mode 100644 index 0000000..dcdee97 --- /dev/null +++ b/doc/git-rrp/git-rrp.gitconfig @@ -0,0 +1,2 @@ +[alias] + rrp = "remote prune" diff --git a/doc/git-rrs/alias.txt b/doc/git-rrs/alias.txt new file mode 100644 index 0000000..b840c89 --- /dev/null +++ b/doc/git-rrs/alias.txt @@ -0,0 +1 @@ +remote show diff --git a/doc/git-rrs/description.md b/doc/git-rrs/description.md new file mode 100644 index 0000000..3d8fd4c --- /dev/null +++ b/doc/git-rrs/description.md @@ -0,0 +1,7 @@ +Remote show i.e. give information about the remote . + +Example: + +```shell +git rrs +``` diff --git a/doc/git-rrs/git-rrs.gitconfig b/doc/git-rrs/git-rrs.gitconfig new file mode 100644 index 0000000..7d45384 --- /dev/null +++ b/doc/git-rrs/git-rrs.gitconfig @@ -0,0 +1,2 @@ +[alias] + rrs = "remote show" diff --git a/doc/git-rru/alias.txt b/doc/git-rru/alias.txt new file mode 100644 index 0000000..d786f99 --- /dev/null +++ b/doc/git-rru/alias.txt @@ -0,0 +1 @@ +remote update diff --git a/doc/git-rru/description.md b/doc/git-rru/description.md new file mode 100644 index 0000000..a75c6ed --- /dev/null +++ b/doc/git-rru/description.md @@ -0,0 +1,7 @@ +remote update i.e. fetch updates for a named set of remotes in the repository as defined by remotes. + +Example: + +```shell +git rru +``` diff --git a/doc/git-rru/git-rru.gitconfig b/doc/git-rru/git-rru.gitconfig new file mode 100644 index 0000000..48bc0c3 --- /dev/null +++ b/doc/git-rru/git-rru.gitconfig @@ -0,0 +1,2 @@ +[alias] + rru = "remote update" diff --git a/doc/git-rv/alias.txt b/doc/git-rv/alias.txt new file mode 100644 index 0000000..5de733e --- /dev/null +++ b/doc/git-rv/alias.txt @@ -0,0 +1 @@ +revert diff --git a/doc/git-rv/description.md b/doc/git-rv/description.md new file mode 100644 index 0000000..fca5002 --- /dev/null +++ b/doc/git-rv/description.md @@ -0,0 +1,9 @@ +Short for "git revert". + +Example: + +```shell +git rv +``` + +Revert will undo the changes from some existing commits. diff --git a/doc/git-rv/git-rv.gitconfig b/doc/git-rv/git-rv.gitconfig new file mode 100644 index 0000000..fb0c813 --- /dev/null +++ b/doc/git-rv/git-rv.gitconfig @@ -0,0 +1,2 @@ +[alias] + rv = "revert" diff --git a/doc/git-rvnc/alias.txt b/doc/git-rvnc/alias.txt new file mode 100644 index 0000000..5dd968f --- /dev/null +++ b/doc/git-rvnc/alias.txt @@ -0,0 +1 @@ +revert --no-commit diff --git a/doc/git-rvnc/description.md b/doc/git-rvnc/description.md new file mode 100644 index 0000000..739641b --- /dev/null +++ b/doc/git-rvnc/description.md @@ -0,0 +1,10 @@ +Revert with no commit i.e. without autocommit. + +Example: + +```shell +git rvnc +``` + +This can be useful when you're reverting more than one +commits' effect to your index in a row. diff --git a/doc/git-rvnc/git-rvnc.gitconfig b/doc/git-rvnc/git-rvnc.gitconfig new file mode 100644 index 0000000..94cbf42 --- /dev/null +++ b/doc/git-rvnc/git-rvnc.gitconfig @@ -0,0 +1,2 @@ +[alias] + rvnc = "revert --no-commit" diff --git a/doc/git-s/alias.txt b/doc/git-s/alias.txt new file mode 100644 index 0000000..8be5547 --- /dev/null +++ b/doc/git-s/alias.txt @@ -0,0 +1 @@ +status diff --git a/doc/git-s/description.md b/doc/git-s/description.md new file mode 100644 index 0000000..a998898 --- /dev/null +++ b/doc/git-s/description.md @@ -0,0 +1,7 @@ +Short for "git status". + +Example: + +```shell +git s +``` diff --git a/doc/git-s/git-s.gitconfig b/doc/git-s/git-s.gitconfig new file mode 100644 index 0000000..61ffe6b --- /dev/null +++ b/doc/git-s/git-s.gitconfig @@ -0,0 +1,2 @@ +[alias] + s = "status" diff --git a/doc/git-sb/alias.txt b/doc/git-sb/alias.txt new file mode 100644 index 0000000..eb554e0 --- /dev/null +++ b/doc/git-sb/alias.txt @@ -0,0 +1 @@ +show-branch diff --git a/doc/git-sb/description.md b/doc/git-sb/description.md new file mode 100644 index 0000000..7246654 --- /dev/null +++ b/doc/git-sb/description.md @@ -0,0 +1,7 @@ +Short for "git show-branch" i.e. print a list of branches and their commits. + +Example: + +```shell +git sb +``` diff --git a/doc/git-sb/git-sb.gitconfig b/doc/git-sb/git-sb.gitconfig new file mode 100644 index 0000000..a5ffda3 --- /dev/null +++ b/doc/git-sb/git-sb.gitconfig @@ -0,0 +1,2 @@ +[alias] + sb = "show-branch" diff --git a/doc/git-sbdo/description.md b/doc/git-sbdo/description.md new file mode 100644 index 0000000..82b73c2 --- /dev/null +++ b/doc/git-sbdo/description.md @@ -0,0 +1,7 @@ +Show branch list with date order + +Example: + +```shell +git sbdo +``` diff --git a/doc/git-sbto/description.md b/doc/git-sbto/description.md new file mode 100644 index 0000000..90c5285 --- /dev/null +++ b/doc/git-sbto/description.md @@ -0,0 +1,7 @@ +Show branch list with topological order + +Example: + +```shell +git sbto +``` diff --git a/doc/git-search-commits/alias.sh b/doc/git-search-commits/alias.sh new file mode 100644 index 0000000..4f46fcf --- /dev/null +++ b/doc/git-search-commits/alias.sh @@ -0,0 +1 @@ +f() { query="$1"; shift; git log -S"$query" "$@"; }; f "$@" diff --git a/doc/git-search-commits/description.md b/doc/git-search-commits/description.md new file mode 100644 index 0000000..03cddd1 --- /dev/null +++ b/doc/git-search-commits/description.md @@ -0,0 +1,27 @@ +Search for a given string in all patches and print commit messages. + +Example: + +```shell +git search-commits +``` + +Example: search for any commit that adds or removes string "foobar": + +```shell +git search-commits foobar +``` + +Example: search commits for string "foobar" in directory "src/lib": + +```shell +git search-commits foobar src/lib +``` + +Example: search commits for "foobar", print full diff of commit with 1 line context: + +```shell +git search-commits foobar --pickaxe-all -U1 src/lib +``` + +Posted by Mikko Rantalainen on StackOverflow. diff --git a/doc/git-serve/alias.txt b/doc/git-serve/alias.txt new file mode 100644 index 0000000..0cddd2c --- /dev/null +++ b/doc/git-serve/alias.txt @@ -0,0 +1 @@ +-c daemon.receivepack=true daemon --base-path=. --export-all --reuseaddr --verbose diff --git a/doc/git-serve/description.md b/doc/git-serve/description.md new file mode 100644 index 0000000..b7d3d62 --- /dev/null +++ b/doc/git-serve/description.md @@ -0,0 +1,9 @@ +Serve the local directory by starting a Git server daemon. + +Example: + +```shell +git serve +``` + +Serve the local directory by starting a git server daemon, so others can pull/push from my machine. diff --git a/doc/git-serve/git-serve.gitconfig b/doc/git-serve/git-serve.gitconfig new file mode 100644 index 0000000..40a703a --- /dev/null +++ b/doc/git-serve/git-serve.gitconfig @@ -0,0 +1,2 @@ +[alias] + serve = "-c daemon.receivepack=true daemon --base-path=. --export-all --reuseaddr --verbose" diff --git a/doc/git-show-unreachable/alias.sh b/doc/git-show-unreachable/alias.sh new file mode 100644 index 0000000..4d46b0a --- /dev/null +++ b/doc/git-show-unreachable/alias.sh @@ -0,0 +1 @@ +git fsck --unreachable | grep commit | cut -d" " -f3 | xargs git log diff --git a/doc/git-show-unreachable/description.md b/doc/git-show-unreachable/description.md new file mode 100644 index 0000000..fa0311d --- /dev/null +++ b/doc/git-show-unreachable/description.md @@ -0,0 +1,9 @@ +Show logs of unreachable commits. + +Example: + +```shell +git show-unreachable +``` + +This can be useful, for example, when recovering contents of dropped stashes or reset commits. diff --git a/doc/git-sm/alias.txt b/doc/git-sm/alias.txt new file mode 100644 index 0000000..e2d6b89 --- /dev/null +++ b/doc/git-sm/alias.txt @@ -0,0 +1 @@ +submodule diff --git a/doc/git-sm/description.md b/doc/git-sm/description.md new file mode 100644 index 0000000..bf39e7a --- /dev/null +++ b/doc/git-sm/description.md @@ -0,0 +1,9 @@ +Short for "git submodule". + +Example: + +```shell +git sm +``` + +Submodule enables foreign repositories to be embedded within a dedicated subdirectory of the source tree. diff --git a/doc/git-sm/git-sm.gitconfig b/doc/git-sm/git-sm.gitconfig new file mode 100644 index 0000000..cb5861a --- /dev/null +++ b/doc/git-sm/git-sm.gitconfig @@ -0,0 +1,2 @@ +[alias] + sm = "submodule" diff --git a/doc/git-sma/alias.txt b/doc/git-sma/alias.txt new file mode 100644 index 0000000..8906d57 --- /dev/null +++ b/doc/git-sma/alias.txt @@ -0,0 +1 @@ +submodule add diff --git a/doc/git-sma/description.md b/doc/git-sma/description.md new file mode 100644 index 0000000..3c0a957 --- /dev/null +++ b/doc/git-sma/description.md @@ -0,0 +1,7 @@ +Submodule add i.e. add a submodule to this repo. + +Example: + +```shell +git sma foo +``` diff --git a/doc/git-sma/git-sma.gitconfig b/doc/git-sma/git-sma.gitconfig new file mode 100644 index 0000000..bad2b76 --- /dev/null +++ b/doc/git-sma/git-sma.gitconfig @@ -0,0 +1,2 @@ +[alias] + sma = "submodule add" diff --git a/doc/git-smi/alias.txt b/doc/git-smi/alias.txt new file mode 100644 index 0000000..6234efa --- /dev/null +++ b/doc/git-smi/alias.txt @@ -0,0 +1 @@ +submodule init diff --git a/doc/git-smi/description.md b/doc/git-smi/description.md new file mode 100644 index 0000000..9ff514e --- /dev/null +++ b/doc/git-smi/description.md @@ -0,0 +1,7 @@ +Submodule init i.e. initialize a submodule in this repo. + +Example: + +```shell +git smi foo +``` diff --git a/doc/git-smi/git-smi.gitconfig b/doc/git-smi/git-smi.gitconfig new file mode 100644 index 0000000..cf6140e --- /dev/null +++ b/doc/git-smi/git-smi.gitconfig @@ -0,0 +1,2 @@ +[alias] + smi = "submodule init" diff --git a/doc/git-sms/alias.txt b/doc/git-sms/alias.txt new file mode 100644 index 0000000..f2a0a6e --- /dev/null +++ b/doc/git-sms/alias.txt @@ -0,0 +1 @@ +submodule sync diff --git a/doc/git-sms/description.md b/doc/git-sms/description.md new file mode 100644 index 0000000..2e4206a --- /dev/null +++ b/doc/git-sms/description.md @@ -0,0 +1,7 @@ +Submodule sync i.e. synchronize a submodule in this repo. + +Example: + +```shell +git sms foo +``` diff --git a/doc/git-sms/git-sms.gitconfig b/doc/git-sms/git-sms.gitconfig new file mode 100644 index 0000000..58e695a --- /dev/null +++ b/doc/git-sms/git-sms.gitconfig @@ -0,0 +1,2 @@ +[alias] + sms = "submodule sync" diff --git a/doc/git-smu/alias.txt b/doc/git-smu/alias.txt new file mode 100644 index 0000000..dfbaa3e --- /dev/null +++ b/doc/git-smu/alias.txt @@ -0,0 +1 @@ +submodule update diff --git a/doc/git-smu/description.md b/doc/git-smu/description.md new file mode 100644 index 0000000..64438ea --- /dev/null +++ b/doc/git-smu/description.md @@ -0,0 +1,7 @@ +Submodule update i.e. update a submodule in this repo. + +Example: + +```shell +git smu foo +``` diff --git a/doc/git-smu/git-smu.gitconfig b/doc/git-smu/git-smu.gitconfig new file mode 100644 index 0000000..68042bf --- /dev/null +++ b/doc/git-smu/git-smu.gitconfig @@ -0,0 +1,2 @@ +[alias] + smu = "submodule update" diff --git a/doc/git-smui/alias.txt b/doc/git-smui/alias.txt new file mode 100644 index 0000000..29c77fe --- /dev/null +++ b/doc/git-smui/alias.txt @@ -0,0 +1 @@ +submodule update --init diff --git a/doc/git-smui/description.md b/doc/git-smui/description.md new file mode 100644 index 0000000..83f1f29 --- /dev/null +++ b/doc/git-smui/description.md @@ -0,0 +1,7 @@ +Submodule update with initialize. + +Example: + +```shell +git smui foo +``` diff --git a/doc/git-smui/git-smui.gitconfig b/doc/git-smui/git-smui.gitconfig new file mode 100644 index 0000000..d666e36 --- /dev/null +++ b/doc/git-smui/git-smui.gitconfig @@ -0,0 +1,2 @@ +[alias] + smui = "submodule update --init" diff --git a/doc/git-smuir/alias.txt b/doc/git-smuir/alias.txt new file mode 100644 index 0000000..955f003 --- /dev/null +++ b/doc/git-smuir/alias.txt @@ -0,0 +1 @@ +submodule update --init --recursive diff --git a/doc/git-smuir/description.md b/doc/git-smuir/description.md new file mode 100644 index 0000000..55fe3c6 --- /dev/null +++ b/doc/git-smuir/description.md @@ -0,0 +1,9 @@ +Submodule update with initialize and recursive; this is useful to bring a submodule fully up to date. + +Example: + +```shell +git smuir foo +``` + +This can be useful to bring a submodule fully up to date. diff --git a/doc/git-smuir/git-smuir.gitconfig b/doc/git-smuir/git-smuir.gitconfig new file mode 100644 index 0000000..6357289 --- /dev/null +++ b/doc/git-smuir/git-smuir.gitconfig @@ -0,0 +1,2 @@ +[alias] + smuir = "submodule update --init --recursive" diff --git a/doc/git-snapshot/alias.sh b/doc/git-snapshot/alias.sh new file mode 100644 index 0000000..4c4d68b --- /dev/null +++ b/doc/git-snapshot/alias.sh @@ -0,0 +1 @@ +git stash push --include-untracked --message "snapshot: $(date)" && git stash apply "stash@{0}" --index diff --git a/doc/git-snapshot/description.md b/doc/git-snapshot/description.md new file mode 100644 index 0000000..df81482 --- /dev/null +++ b/doc/git-snapshot/description.md @@ -0,0 +1,28 @@ +Take a snapshot of your current working tree. + +Example: + +```shell +git snapshot +``` + +Take a snapshot of your current working tree without removing changes. + +This is handy for refactoring where you can't quite fit what you've done +into a commit but daren't stray too far from now without a backup. + +Running this … + +```shell +git snapshot +``` + +… creates this stash: + +```shell +stash@{0}: On feature/handy-git-tricks: snapshot: Mon Apr 8 12:39:06 BST 2013 +``` + +… and seemingly no changes to your working tree. + +From diff --git a/doc/git-ss/alias.txt b/doc/git-ss/alias.txt new file mode 100644 index 0000000..d8fdada --- /dev/null +++ b/doc/git-ss/alias.txt @@ -0,0 +1 @@ +status --short diff --git a/doc/git-ss/description.md b/doc/git-ss/description.md new file mode 100644 index 0000000..0f4e741 --- /dev/null +++ b/doc/git-ss/description.md @@ -0,0 +1,7 @@ +Status with short format. + +Example: + +```shell +git ss +``` diff --git a/doc/git-ss/git-ss.gitconfig b/doc/git-ss/git-ss.gitconfig new file mode 100644 index 0000000..c8d1f56 --- /dev/null +++ b/doc/git-ss/git-ss.gitconfig @@ -0,0 +1,2 @@ +[alias] + ss = "status --short" diff --git a/doc/git-ssb/alias.txt b/doc/git-ssb/alias.txt new file mode 100644 index 0000000..808e9e7 --- /dev/null +++ b/doc/git-ssb/alias.txt @@ -0,0 +1 @@ +status --short --branch diff --git a/doc/git-ssb/description.md b/doc/git-ssb/description.md new file mode 100644 index 0000000..9e4d227 --- /dev/null +++ b/doc/git-ssb/description.md @@ -0,0 +1,7 @@ +Status with short format and branch info. + +Example: + +```shell +git ssb +``` diff --git a/doc/git-ssb/git-ssb.gitconfig b/doc/git-ssb/git-ssb.gitconfig new file mode 100644 index 0000000..612ebf4 --- /dev/null +++ b/doc/git-ssb/git-ssb.gitconfig @@ -0,0 +1,2 @@ +[alias] + ssb = "status --short --branch" diff --git a/doc/git-stashes/alias.txt b/doc/git-stashes/alias.txt new file mode 100644 index 0000000..97a9358 --- /dev/null +++ b/doc/git-stashes/alias.txt @@ -0,0 +1 @@ +stash list diff --git a/doc/git-stashes/description.md b/doc/git-stashes/description.md new file mode 100644 index 0000000..0b8a3f5 --- /dev/null +++ b/doc/git-stashes/description.md @@ -0,0 +1,17 @@ +List stashes. + +Example: + +```shell +git stashes +``` + +This alias is because friendly wording is easier to remember. + +Our friendly wording for plurals: +* [git aliases](../git-aliases) +* [git branches](../git-branches) +* [git stashes](../git-stashes) +* [git tags](../git-tags) + +Thanks to . diff --git a/doc/git-stashes/git-stashes.gitconfig b/doc/git-stashes/git-stashes.gitconfig new file mode 100644 index 0000000..8aa8736 --- /dev/null +++ b/doc/git-stashes/git-stashes.gitconfig @@ -0,0 +1,2 @@ +[alias] + stashes = "stash list" diff --git a/doc/git-submodule/description.md b/doc/git-submodule/description.md new file mode 100644 index 0000000..8ba106b --- /dev/null +++ b/doc/git-submodule/description.md @@ -0,0 +1,14 @@ +# git submodule + +## Aliases related to git submodule + + +### Shortcuts + +* [git sm](git-sm) = submodule +* [git smi](git-smi) = submodule init +* [git sma](git-sma) = submodule add +* [git sms](git-sms) = submodule sync +* [git smu](git-smu) = submodule update +* [git smui](git-smui) = submodule update --init +* [git smuir](git-smuir) = submodule update --init --recursive diff --git a/doc/git-summary/alias.sh b/doc/git-summary/alias.sh new file mode 100644 index 0000000..8799280 --- /dev/null +++ b/doc/git-summary/alias.sh @@ -0,0 +1,26 @@ +f() { printf "Summary of this branch... +"; printf "%s +" "$(git rev-parse --abbrev-ref HEAD)"; printf "%s first commit timestamp +" "$(git log --date-order --format=%cI | tail -1)"; printf "%s last commit timestamp +" "$(git log -1 --date-order --format=%cI)"; printf " +Summary of counts... +"; printf "%d commit count +" "$(git rev-list --count HEAD)"; printf "%d date count +" "$(git log --format=oneline --format="%ad" --date=format:"%Y-%m-%d" | awk '{a[$0]=1}END{for(i in a){n++;} print n}')"; printf "%d tag count +" "$(git tag | wc -l)"; printf "%d author count +" "$(git log --format=oneline --format="%aE" | awk '{a[$0]=1}END{for(i in a){n++;} print n}')"; printf "%d committer count +" "$(git log --format=oneline --format="%cE" | awk '{a[$0]=1}END{for(i in a){n++;} print n}')"; printf "%d local branch count +" "$(git branch | grep -vc " -> ")"; printf "%d remote branch count +" "$(git branch -r | grep -vc " -> ")"; printf " +Summary of this directory... +"; printf "%s +" "$(pwd)"; printf "%d file count via git ls-files +" "$(git ls-files | wc -l)"; printf "%d file count via find command +" "$(find . | wc -l)"; printf "%d disk usage +" "$(du -s | awk '{print $1}')"; printf " +Most-active authors, with commit count and %%... +"; git log-of-count-and-email | head -7; printf " +Most-active dates, with commit count and %%... +"; git log-of-count-and-day | head -7; printf " +Most-active files, with churn count +"; git churn | head -7; }; f diff --git a/doc/git-summary/description.md b/doc/git-summary/description.md new file mode 100644 index 0000000..ad316f2 --- /dev/null +++ b/doc/git-summary/description.md @@ -0,0 +1,70 @@ +Show a summary of overview metrics. + +Example: + +```shell +git summary + +Summary of this branch... +main +2016-06-17T22:05:43-04:00 first commit timestamp +2022-01-10T19:41:43+00:00 last commit timestamp + +Summary of counts... +330 commit count +112 date count +0 tag count +31 author count +22 committer count +1 local branch count +3 remote branch count + +Summary of this directory... +~gitalias/gitalias +315 file count via git ls-files +4921 file count via find command +41912 disk usage + +Most-active authors, with commit count and %... +246 74% joel@joelparkerhenderson.com +19 5% phd@phdru.name +13 3% alice@example.com + +Most-active dates, with commit count and %... +16 4% 2019-01-16 +14 4% 2016-06-19 +10 3% 2019-07-03 + +Most-active files, with churn count +211 gitalias.txt +78 README.md +4 doc/install/install.md +``` + +Summary of the branch: + + * First commit timestamp + * Last commit timestamp + +Summary of the counts: + + * Commit count + * Date count + * Tag count + * Author count + * Committer count + * Local branch count + * Remote branch count + +Summary of the directory: + + * Directory path + * File count via git ls-files + * File count via find command + * Disk usage + +Summary of activity: + + * Most-active authors + * Most-active dates + * Most-active files diff --git a/doc/git-svn-b/alias.txt b/doc/git-svn-b/alias.txt new file mode 100644 index 0000000..8e1ef64 --- /dev/null +++ b/doc/git-svn-b/alias.txt @@ -0,0 +1 @@ +svn branch diff --git a/doc/git-svn-b/description.md b/doc/git-svn-b/description.md new file mode 100644 index 0000000..15750bd --- /dev/null +++ b/doc/git-svn-b/description.md @@ -0,0 +1,7 @@ +Subversion branch. + +Example: + +```shell +git svn-b +``` diff --git a/doc/git-svn-b/git-svn-b.gitconfig b/doc/git-svn-b/git-svn-b.gitconfig new file mode 100644 index 0000000..621484e --- /dev/null +++ b/doc/git-svn-b/git-svn-b.gitconfig @@ -0,0 +1,2 @@ +[alias] + svn-b = "svn branch" diff --git a/doc/git-svn-c/alias.txt b/doc/git-svn-c/alias.txt new file mode 100644 index 0000000..d0d54f6 --- /dev/null +++ b/doc/git-svn-c/alias.txt @@ -0,0 +1 @@ +svn dcommit diff --git a/doc/git-svn-c/description.md b/doc/git-svn-c/description.md new file mode 100644 index 0000000..a9a22b7 --- /dev/null +++ b/doc/git-svn-c/description.md @@ -0,0 +1,7 @@ +Subversion commit. + +Example: + +```shell +git svn-c +``` diff --git a/doc/git-svn-c/git-svn-c.gitconfig b/doc/git-svn-c/git-svn-c.gitconfig new file mode 100644 index 0000000..3b8cbb2 --- /dev/null +++ b/doc/git-svn-c/git-svn-c.gitconfig @@ -0,0 +1,2 @@ +[alias] + svn-c = "svn dcommit" diff --git a/doc/git-svn-cp/alias.sh b/doc/git-svn-cp/alias.sh new file mode 100644 index 0000000..90eb924 --- /dev/null +++ b/doc/git-svn-cp/alias.sh @@ -0,0 +1 @@ +GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick --edit diff --git a/doc/git-svn-cp/description.md b/doc/git-svn-cp/description.md new file mode 100644 index 0000000..11b4745 --- /dev/null +++ b/doc/git-svn-cp/description.md @@ -0,0 +1,7 @@ +Subversion cherry pick. + +Example: + +```shell +git svn-cp +``` diff --git a/doc/git-svn-m/alias.txt b/doc/git-svn-m/alias.txt new file mode 100644 index 0000000..00f434e --- /dev/null +++ b/doc/git-svn-m/alias.txt @@ -0,0 +1 @@ +merge --squash diff --git a/doc/git-svn-m/description.md b/doc/git-svn-m/description.md new file mode 100644 index 0000000..e7afdbc --- /dev/null +++ b/doc/git-svn-m/description.md @@ -0,0 +1,7 @@ +Subversion merge. + +Example: + +```shell +git svn-m +``` diff --git a/doc/git-svn-m/git-svn-m.gitconfig b/doc/git-svn-m/git-svn-m.gitconfig new file mode 100644 index 0000000..f46a469 --- /dev/null +++ b/doc/git-svn-m/git-svn-m.gitconfig @@ -0,0 +1,2 @@ +[alias] + svn-m = "merge --squash" diff --git a/doc/git-svn/description.md b/doc/git-svn/description.md new file mode 100644 index 0000000..642572e --- /dev/null +++ b/doc/git-svn/description.md @@ -0,0 +1,21 @@ +# git svn-* + +## Subversion version control helpers + +Git alias: + +```git +svn-b = svn branch +svn-m = merge --squash +svn-c = svn dcommit +svn-cp = !GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick --edit +``` + +Example: + +```shell +git svn-b +git svn-m +git svn-c +git svn-cp +``` diff --git a/doc/git-tags/alias.txt b/doc/git-tags/alias.txt new file mode 100644 index 0000000..f89dc0b --- /dev/null +++ b/doc/git-tags/alias.txt @@ -0,0 +1 @@ +tag -n1 --list diff --git a/doc/git-tags/description.md b/doc/git-tags/description.md new file mode 100644 index 0000000..652de8b --- /dev/null +++ b/doc/git-tags/description.md @@ -0,0 +1,21 @@ +List tags. + +Example: + +```shell +git tags +``` + +This alias is because friendly wording is easier to remember. + +Our friendly wording for plurals: + +* [git aliases](../git-aliases) + +* [git branches](../git-branches) + +* [git stashes](../git-stashes) + +* [git tags](../git-tags) + +Thanks diff --git a/doc/git-tags/git-tags.gitconfig b/doc/git-tags/git-tags.gitconfig new file mode 100644 index 0000000..87a775f --- /dev/null +++ b/doc/git-tags/git-tags.gitconfig @@ -0,0 +1,2 @@ +[alias] + tags = "tag -n1 --list" diff --git a/doc/git-theirs/alias.sh b/doc/git-theirs/alias.sh new file mode 100644 index 0000000..8ee4598 --- /dev/null +++ b/doc/git-theirs/alias.sh @@ -0,0 +1 @@ +f() { git checkout --theirs "$@" && git add "$@"; }; f diff --git a/doc/git-theirs/description.md b/doc/git-theirs/description.md new file mode 100644 index 0000000..3485c38 --- /dev/null +++ b/doc/git-theirs/description.md @@ -0,0 +1,15 @@ +Checkout their version of a file and add it. + +Example: + +```shell +git theirs +``` + +Compare: + +* [git ours & git theirs](../git-ours-git-theirs) (describes both) + +* [git ours](../git-ours) + +* [git theirs](../git-theirs) (this alias) diff --git a/doc/git-top/alias.txt b/doc/git-top/alias.txt new file mode 100644 index 0000000..42c595b --- /dev/null +++ b/doc/git-top/alias.txt @@ -0,0 +1 @@ +rev-parse --show-toplevel diff --git a/doc/git-top/description.md b/doc/git-top/description.md new file mode 100644 index 0000000..fb8b937 --- /dev/null +++ b/doc/git-top/description.md @@ -0,0 +1,8 @@ +Get the top level directory name. + +Example: + +```shell +git top +/home/alice/projects/example +``` diff --git a/doc/git-top/git-top.gitconfig b/doc/git-top/git-top.gitconfig new file mode 100644 index 0000000..2a2deb6 --- /dev/null +++ b/doc/git-top/git-top.gitconfig @@ -0,0 +1,2 @@ +[alias] + top = "rev-parse --show-toplevel" diff --git a/doc/git-topic-base-branch/alias.sh b/doc/git-topic-base-branch/alias.sh new file mode 100644 index 0000000..0c418e1 --- /dev/null +++ b/doc/git-topic-base-branch/alias.sh @@ -0,0 +1 @@ +git config --get init.topicBaseBranchName || git default-branch diff --git a/doc/git-topic-base-branch/description.md b/doc/git-topic-base-branch/description.md new file mode 100644 index 0000000..c0e8f29 --- /dev/null +++ b/doc/git-topic-base-branch/description.md @@ -0,0 +1,49 @@ +Show the project base topic branch name. + +Example: + +``` +git topic-base-branch +main +``` + +Customize this alias as you like for your own workflow. + +When we do topic branches, we use a base topic branch, +and use it to create new topic branches, and also use +it to receive changes from completed topic branches. + +The base topic branch defaults to the repo default branch, +such as the "main" branch; this makes it easy to use topic +branching in many popular git repos that use the "main" branch +for trunk-based development and integration of pull requests. + +Some teams prefer to have a specific base topic branch that +is different than the repo default branch, typically in order +to do various integration tests and/or release processes. + +For example, some teams prefer to have a branch named "topic" +or "development" or "integration", in order to do continuous +integration tests and continuous delivery release processes. + +You can customize the base topic branch name by using `git config`. + +You can customize it for your local repo, or your own user's global +configuration, or your system configuration, by using `git config`: + +```shell +git config --local init.topicBaseBranchName "foo" + +git config --global init.topicBaseBranchName "foo" + +git config --system init.topicBaseBranchName "foo" +``` + +Example: + +``` +git config init.topicBaseBranchName "foo" +git topic-base-branch +foo +``` + diff --git a/doc/git-topic-begin/alias.sh b/doc/git-topic-begin/alias.sh new file mode 100644 index 0000000..4053f0c --- /dev/null +++ b/doc/git-topic-begin/alias.sh @@ -0,0 +1 @@ +f(){ new_branch="$1"; old_branch="$(git topic-base-branch)"; git checkout "$old_branch"; git pull --ff-only; git checkout -b "$new_branch" "$old_branch"; git push -u origin "$new_branch"; };f diff --git a/doc/git-topic-begin/description.md b/doc/git-topic-begin/description.md new file mode 100644 index 0000000..655d69d --- /dev/null +++ b/doc/git-topic-begin/description.md @@ -0,0 +1,27 @@ +Start a new topic branch. + +Example: + +```shell +git topic-begin add-feature-foo +``` + +Customize this alias as you like for your own workflow. + +We use this alias to begin work on a new feature, +new task, new fix, new refactor, new optimization, etc. + +Our workflow does these steps: + + 1. Update the base topic branch. + + 2. Create a new topic branch based on the topic base branch name, + + 3. Push the new topic branch, so team members can see it. + +If you use a sharing site such a GitHub, and use typical settings, +then this implementation makes your branch visible to collaborators. + +Many teams share branches before they are fully ready, to help +the team provide feedback on the work-in-progress, and also to +run any automatic tests to verify the branch runs successfully. diff --git a/doc/git-topic-end/alias.sh b/doc/git-topic-end/alias.sh new file mode 100644 index 0000000..378496e --- /dev/null +++ b/doc/git-topic-end/alias.sh @@ -0,0 +1,6 @@ +f(){ new_branch="$(git current-branch)"; old_branch="$(git topic-base-branch)"; if [ "$new_branch" = "$old_branch" ]; then printf "You are asking to do git topic-end, +"; printf "but you are not on a new topic branch; +"; printf "you are on the base topic branch: %s. +" "$old_branch"; printf "Please checkout the topic branch that you want, +"; printf "then retry the git topic-end command. +"; else git push; git checkout "$old_branch"; git branch --delete "$new_branch"; git push origin ":$new_branch"; fi; };f diff --git a/doc/git-topic-end/description.md b/doc/git-topic-end/description.md new file mode 100644 index 0000000..12875cc --- /dev/null +++ b/doc/git-topic-end/description.md @@ -0,0 +1,34 @@ +Finish the current topic branch. + +Example: + +```shell +git topic-end +``` + +Customize this alias as you like for your own workflow. + +This must be the current branch. + +We use this alias to complete work on a new feature, +new task, new fix, new refactor, new optimization, etc. + +Our workflow does these steps: + + 1. Push the topic branch. + + 2. Delete the topic branch locally. + + 3. Delete the topic branch remotely. + +If you use a sharing site such a GitHub, and use typical settings, +then this implementation deletes your branch for the site. + +Many teams choose to delete topic branches when they are finished, +to keep the repositories clean and with a smaller number of branches. + +If git says "unable to push to unqualified destination" then it means +that the remote branch doesn't exist, so git is unable to delete it; +that message is typically ok because it means that someone else has +already deleted the branch. To synchronize your branch list, you can +use "git fetch --prune". diff --git a/doc/git-topic-move/alias.sh b/doc/git-topic-move/alias.sh new file mode 100644 index 0000000..ac919ff --- /dev/null +++ b/doc/git-topic-move/alias.sh @@ -0,0 +1 @@ +f(){ new_branch="$1"; old_branch="$(git current-branch)"; git branch --move "$old_branch" "$new_branch"; git push origin ":$old_branch" "$new_branch"; };f diff --git a/doc/git-topic-move/description.md b/doc/git-topic-move/description.md new file mode 100644 index 0000000..5d08cc2 --- /dev/null +++ b/doc/git-topic-move/description.md @@ -0,0 +1,15 @@ +Rename the current topic branch. + +Example: + +```shell +git topic-move foo +``` + +Customize this alias as you like for your own workflow. + +Our workflow does these steps: + + 1. Move the local branch. + + 2. Move the remote branch by pushing to origin. diff --git a/doc/git-topic-sync/alias.sh b/doc/git-topic-sync/alias.sh new file mode 100644 index 0000000..0fb1c2e --- /dev/null +++ b/doc/git-topic-sync/alias.sh @@ -0,0 +1,6 @@ +f(){ new_branch="$(git current-branch)"; old_branch="$(git topic-base-branch)"; if [ "$new_branch" = "$old_branch" ]; then printf "You are asking to do git topic-sync, +"; printf "but you are not on a new topic branch; +"; printf "you are on the base topic branch: %s. +" "$old_branch"; printf "Please checkout the topic branch that you want, +"; printf "then retry the git topic-sync command. +"; else git pull; git push; fi; };f diff --git a/doc/git-topic-sync/description.md b/doc/git-topic-sync/description.md new file mode 100644 index 0000000..2e6f821 --- /dev/null +++ b/doc/git-topic-sync/description.md @@ -0,0 +1,19 @@ +Synchronize the current topic branch by doing updates. + +Example: + +```shell +git topic-sync +``` + +Customize this alias as you like for your own workflow. + +Our workflow does these steps: + + 1. Pull any changes. + + 2. Push any changes. + +If you use any kind of testing framework, or test driven development, +then it can be wise to test your topic immediately after running this, +to ensure that any available updates are successfully integrated. diff --git a/doc/git-topic/description.md b/doc/git-topic/description.md new file mode 100644 index 0000000..f7d65a1 --- /dev/null +++ b/doc/git-topic/description.md @@ -0,0 +1,61 @@ +# git topic-* + +## Topic branch aliases + +* [git topic-base-branch](../git-topic-base-branch) + +* [git topic-begin](../git-topic-begin) + +* [git topic-end](../git-topic-end) + +* [git topic-sync](../git-topic-sync) + +* [git topic-move](../git-topic-move) + +These aliases are simple starting points for a simple topic flow. + +Lots of people have lots of ideas about how to do various git flows. + +Some people like to use a topic branch for a new feature, or a +hotfix patch, or refactoring work, or some spike research, etc. + +Show your project's topic base branch name: + +```shell +git topic-base-branch +``` + +Begin your topic work by creating a new topic branch: + +```shell +git topic-begin +``` + +End your topic work by finishing your existing topic branch: + +```shell +git topic-end +``` + +Optional: synchronize your topic work, which pushes and pulls: + +```shell +git topic-sync +``` + +Optional: move your topic branch name i.e. rename your topic branch: + +```shell +git topic-move +``` + +Ideas for your own alias customizations: + + * Notify your team, such as by sending an email, posting to chat, etc. + + * Trigger testing of the new topic branch to ensure all tests succeed. + + * Update your project management software with the new topic name. + +Customize these aliases as you like for your own workflow. + diff --git a/doc/git-track-all-remote-branches/alias.sh b/doc/git-track-all-remote-branches/alias.sh new file mode 100644 index 0000000..0df7408 --- /dev/null +++ b/doc/git-track-all-remote-branches/alias.sh @@ -0,0 +1 @@ +f() { git branch -r | grep -v ' -> ' | sed 's/^ \+origin\///' ; }; f diff --git a/doc/git-track-all-remote-branches/description.md b/doc/git-track-all-remote-branches/description.md new file mode 100644 index 0000000..e86f910 --- /dev/null +++ b/doc/git-track-all-remote-branches/description.md @@ -0,0 +1,11 @@ +Track all remote branches that aren't already being tracked. + +Example: + +```shell +git track-all-remote-branches +``` + +This alias is a bit hacky because of the parsing; +we welcome better code that works using more-specific +git commands. diff --git a/doc/git-track/alias.sh b/doc/git-track/alias.sh new file mode 100644 index 0000000..b76dc35 --- /dev/null +++ b/doc/git-track/alias.sh @@ -0,0 +1 @@ +f(){ branch="$(git rev-parse --abbrev-ref HEAD)"; cmd="git branch $branch -u ${1:-origin}/${2:-$branch}"; echo "$cmd"; $cmd; }; f diff --git a/doc/git-track/description.md b/doc/git-track/description.md new file mode 100644 index 0000000..37b9c62 --- /dev/null +++ b/doc/git-track/description.md @@ -0,0 +1,9 @@ +Start tracking a branch, with default parameters, and showing the command. + +Example: + +```shell +git track +``` + +Compare [git untrack](../git-untrack). diff --git a/doc/git-unadd/alias.txt b/doc/git-unadd/alias.txt new file mode 100644 index 0000000..225f7bc --- /dev/null +++ b/doc/git-unadd/alias.txt @@ -0,0 +1 @@ +reset HEAD diff --git a/doc/git-unadd/description.md b/doc/git-unadd/description.md new file mode 100644 index 0000000..165aa44 --- /dev/null +++ b/doc/git-unadd/description.md @@ -0,0 +1,7 @@ +Reset something that's been added. + +Example: + +```shell +git unadd +``` diff --git a/doc/git-unadd/git-unadd.gitconfig b/doc/git-unadd/git-unadd.gitconfig new file mode 100644 index 0000000..54516c5 --- /dev/null +++ b/doc/git-unadd/git-unadd.gitconfig @@ -0,0 +1,2 @@ +[alias] + unadd = "reset HEAD" diff --git a/doc/git-unassume-all/alias.sh b/doc/git-unassume-all/alias.sh new file mode 100644 index 0000000..eb338c5 --- /dev/null +++ b/doc/git-unassume-all/alias.sh @@ -0,0 +1 @@ +git assumed | xargs -r git update-index --no-assume-unchanged diff --git a/doc/git-unassume-all/description.md b/doc/git-unassume-all/description.md new file mode 100644 index 0000000..28d9144 --- /dev/null +++ b/doc/git-unassume-all/description.md @@ -0,0 +1,9 @@ +Unassume all files. + +Example: + +```shell +git unassume-all +``` + +To see how this works, see [git assume-* & git unassume-*](../git-assume-and-git-unassume) diff --git a/doc/git-unassume-all/index.md b/doc/git-unassume-all/index.md index fe7a053..7917621 100644 --- a/doc/git-unassume-all/index.md +++ b/doc/git-unassume-all/index.md @@ -1,4 +1,4 @@ -# git unassume +# git unassume-all ## Unassume all files diff --git a/doc/git-unassume/alias.txt b/doc/git-unassume/alias.txt new file mode 100644 index 0000000..890ea3e --- /dev/null +++ b/doc/git-unassume/alias.txt @@ -0,0 +1 @@ +update-index --no-assume-unchanged diff --git a/doc/git-unassume/description.md b/doc/git-unassume/description.md new file mode 100644 index 0000000..1ffa3ec --- /dev/null +++ b/doc/git-unassume/description.md @@ -0,0 +1,9 @@ +Unassume files. + +Example: + +```shell +git unassumed +``` + +To see how this works, see [git assume-* & git unassume-*](../git-assume-and-git-unassume) diff --git a/doc/git-unassume/git-unassume.gitconfig b/doc/git-unassume/git-unassume.gitconfig new file mode 100644 index 0000000..f7c44e7 --- /dev/null +++ b/doc/git-unassume/git-unassume.gitconfig @@ -0,0 +1,2 @@ +[alias] + unassume = "update-index --no-assume-unchanged" diff --git a/doc/git-uncommit/alias.txt b/doc/git-uncommit/alias.txt new file mode 100644 index 0000000..3e7d654 --- /dev/null +++ b/doc/git-uncommit/alias.txt @@ -0,0 +1 @@ +reset --soft HEAD~1 diff --git a/doc/git-uncommit/description.md b/doc/git-uncommit/description.md new file mode 100644 index 0000000..919d3f7 --- /dev/null +++ b/doc/git-uncommit/description.md @@ -0,0 +1,7 @@ +Reset one commit. + +Example: + +```shell +git uncommit +``` diff --git a/doc/git-uncommit/git-uncommit.gitconfig b/doc/git-uncommit/git-uncommit.gitconfig new file mode 100644 index 0000000..67f486b --- /dev/null +++ b/doc/git-uncommit/git-uncommit.gitconfig @@ -0,0 +1,2 @@ +[alias] + uncommit = "reset --soft HEAD~1" diff --git a/doc/git-undo-commit-hard-clean/alias.sh b/doc/git-undo-commit-hard-clean/alias.sh new file mode 100644 index 0000000..d607f23 --- /dev/null +++ b/doc/git-undo-commit-hard-clean/alias.sh @@ -0,0 +1 @@ +git reset --hard HEAD~1 && git clean -fd diff --git a/doc/git-undo-commit-hard-clean/description.md b/doc/git-undo-commit-hard-clean/description.md new file mode 100644 index 0000000..414a301 --- /dev/null +++ b/doc/git-undo-commit-hard-clean/description.md @@ -0,0 +1,12 @@ +Undo a commit with a hard reset and a clean. + +Example: + +```shell +git undo-commit-hard-clean +``` + +See how to use this alias and related ones: + +* [git undo-*](../git-undo) +* [git reset-*](../git-reset) diff --git a/doc/git-undo-commit-hard/alias.txt b/doc/git-undo-commit-hard/alias.txt new file mode 100644 index 0000000..f4a1930 --- /dev/null +++ b/doc/git-undo-commit-hard/alias.txt @@ -0,0 +1 @@ +reset --hard HEAD~1 diff --git a/doc/git-undo-commit-hard/description.md b/doc/git-undo-commit-hard/description.md new file mode 100644 index 0000000..f503b56 --- /dev/null +++ b/doc/git-undo-commit-hard/description.md @@ -0,0 +1,12 @@ +Undo a commit with a hard reset. + +Example: + +```shell +git undo-commit-hard +``` + +See how to use this alias and related ones: + +* [git undo-*](../git-undo) +* [git reset-*](../git-reset) diff --git a/doc/git-undo-commit-hard/git-undo-commit-hard.gitconfig b/doc/git-undo-commit-hard/git-undo-commit-hard.gitconfig new file mode 100644 index 0000000..75761c7 --- /dev/null +++ b/doc/git-undo-commit-hard/git-undo-commit-hard.gitconfig @@ -0,0 +1,2 @@ +[alias] + undo-commit-hard = "reset --hard HEAD~1" diff --git a/doc/git-undo-commit/alias.txt b/doc/git-undo-commit/alias.txt new file mode 100644 index 0000000..3e7d654 --- /dev/null +++ b/doc/git-undo-commit/alias.txt @@ -0,0 +1 @@ +reset --soft HEAD~1 diff --git a/doc/git-undo-commit/description.md b/doc/git-undo-commit/description.md new file mode 100644 index 0000000..858e25f --- /dev/null +++ b/doc/git-undo-commit/description.md @@ -0,0 +1,12 @@ +Undo a commit with a soft reset. + +Example: + +```shell +git undo-commit +``` + +See how to use this alias and related ones: + +* [git undo-*](../git-undo) +* [git reset-*](../git-reset) diff --git a/doc/git-undo-commit/git-undo-commit.gitconfig b/doc/git-undo-commit/git-undo-commit.gitconfig new file mode 100644 index 0000000..ffe2335 --- /dev/null +++ b/doc/git-undo-commit/git-undo-commit.gitconfig @@ -0,0 +1,2 @@ +[alias] + undo-commit = "reset --soft HEAD~1" diff --git a/doc/git-undo-to-pristine/alias.sh b/doc/git-undo-to-pristine/alias.sh new file mode 100644 index 0000000..64e9766 --- /dev/null +++ b/doc/git-undo-to-pristine/alias.sh @@ -0,0 +1 @@ +git reset --hard && git clean -ffdx diff --git a/doc/git-undo-to-pristine/description.md b/doc/git-undo-to-pristine/description.md new file mode 100644 index 0000000..720a39f --- /dev/null +++ b/doc/git-undo-to-pristine/description.md @@ -0,0 +1,12 @@ +Undo commits and clean all differences. + +Example: + +```shell +git undo-to-pristine +``` + +See how to use this alias and related ones: + +* [git undo-*](../git-undo) +* [git reset-*](../git-reset) diff --git a/doc/git-undo-to-upstream/alias.sh b/doc/git-undo-to-upstream/alias.sh new file mode 100644 index 0000000..392e574 --- /dev/null +++ b/doc/git-undo-to-upstream/alias.sh @@ -0,0 +1 @@ +git reset --hard "$(git upstream-branch)" diff --git a/doc/git-undo-to-upstream/description.md b/doc/git-undo-to-upstream/description.md new file mode 100644 index 0000000..c0fe426 --- /dev/null +++ b/doc/git-undo-to-upstream/description.md @@ -0,0 +1,12 @@ +Undo commits back to the upstream branch. + +Example: + +```shell +git undo-to-upstream +``` + +See how to use this alias and related ones: + +* [git undo-*](../git-undo) +* [git reset-*](../git-reset) diff --git a/doc/git-undo/description.md b/doc/git-undo/description.md new file mode 100644 index 0000000..c6edc55 --- /dev/null +++ b/doc/git-undo/description.md @@ -0,0 +1,28 @@ +# git undo-* + +## Move backwards on the commit chain + +Git alias: + +```git +undo-commit = reset --soft HEAD~1 +undo-commit-hard = reset --hard HEAD~1 +undo-commit-hard-clean = !git reset --hard HEAD~1 && git clean -df +undo-to-pristine = !git reset --hard && git clean -dffx +undo-to-upstream = !git reset --hard $(git upstream-branch) +``` + +Example: + +```shell +git undo-commit +git undo-commit-hard +git undo-commit-hard-clean +git undo-to-pristine +git undo-to-upstream +``` + +These aliases are intentionally identical to the [git reset-*](../git-reset) aliases. + +This is because, in our experience, novices tend to prefer the word "undo" +whereas experts tend to prefer the word "reset". diff --git a/doc/git-unpublish/alias.sh b/doc/git-unpublish/alias.sh new file mode 100644 index 0000000..66d6e82 --- /dev/null +++ b/doc/git-unpublish/alias.sh @@ -0,0 +1 @@ +git push origin :"$(git current-branch)" diff --git a/doc/git-unpublish/description.md b/doc/git-unpublish/description.md new file mode 100644 index 0000000..5c7f29d --- /dev/null +++ b/doc/git-unpublish/description.md @@ -0,0 +1,18 @@ +Unpublish the current branch. + +Unpublish the current branch by deleting the +remote version of the current branch. + +Example: + +```shell +git unpublish +``` + +Compare: + +* [git publish & git unpublish](../git-publish-git-unpublish) (describes both) + +* [git publish](../git-publish) + +* [git unpublish](../git-unpublish) (this alias) diff --git a/doc/git-untrack/alias.sh b/doc/git-untrack/alias.sh new file mode 100644 index 0000000..97f0d72 --- /dev/null +++ b/doc/git-untrack/alias.sh @@ -0,0 +1 @@ +f(){ branch="$(git rev-parse --abbrev-ref HEAD)"; cmd="git branch --unset-upstream ${1:-$branch}"; echo "$cmd"; $cmd; }; f diff --git a/doc/git-untrack/description.md b/doc/git-untrack/description.md new file mode 100644 index 0000000..8a80e37 --- /dev/null +++ b/doc/git-untrack/description.md @@ -0,0 +1,9 @@ +Stop tracking a branch, with default parameters, and show the command. + +Example: + +```shell +git untrack +``` + +Compare [git track](../git-track). diff --git a/doc/git-unwip/alias.sh b/doc/git-unwip/alias.sh new file mode 100644 index 0000000..c04fd43 --- /dev/null +++ b/doc/git-unwip/alias.sh @@ -0,0 +1 @@ +git log -n 1 | grep -q -c wip && git reset HEAD~1 diff --git a/doc/git-unwip/description.md b/doc/git-unwip/description.md new file mode 100644 index 0000000..4e59805 --- /dev/null +++ b/doc/git-unwip/description.md @@ -0,0 +1,15 @@ +Alias for uncommit "work in progress". + +Example: + +```shell +git unwip +``` + +Compare: + +* [git wip & git unwip](../git-wip-git-unwip) (overview) + +* [git wip](../git-wip) + +* [git unwip](../git-unwip) (this alias) diff --git a/doc/git-upstream-branch/alias.sh b/doc/git-upstream-branch/alias.sh new file mode 100644 index 0000000..61511c4 --- /dev/null +++ b/doc/git-upstream-branch/alias.sh @@ -0,0 +1 @@ +git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)" diff --git a/doc/git-upstream-branch/description.md b/doc/git-upstream-branch/description.md new file mode 100644 index 0000000..8dcea9f --- /dev/null +++ b/doc/git-upstream-branch/description.md @@ -0,0 +1,14 @@ +Get the upstream branch name. + +Example: + +```shell +git upstream-branch +origin/main +``` + +Compare: + +* [git current-branch](../git-current-branch) - Get the current branch name + +* [git upstream-branch](../git-upstream-branch) - Get the upstream branch name (this alias) diff --git a/doc/git-w/alias.txt b/doc/git-w/alias.txt new file mode 100644 index 0000000..315aefd --- /dev/null +++ b/doc/git-w/alias.txt @@ -0,0 +1 @@ +whatchanged diff --git a/doc/git-w/description.md b/doc/git-w/description.md new file mode 100644 index 0000000..045d323 --- /dev/null +++ b/doc/git-w/description.md @@ -0,0 +1,7 @@ +Short for "git whatchanged". + +Example: + +```shell +git w +``` diff --git a/doc/git-w/git-w.gitconfig b/doc/git-w/git-w.gitconfig new file mode 100644 index 0000000..8dd8b21 --- /dev/null +++ b/doc/git-w/git-w.gitconfig @@ -0,0 +1,2 @@ +[alias] + w = "whatchanged" diff --git a/doc/git-whatis/alias.txt b/doc/git-whatis/alias.txt new file mode 100644 index 0000000..1791e08 --- /dev/null +++ b/doc/git-whatis/alias.txt @@ -0,0 +1 @@ +show --no-patch --pretty='tformat:%h (%s, %ad)' --date=short diff --git a/doc/git-whatis/description.md b/doc/git-whatis/description.md new file mode 100644 index 0000000..580a27e --- /dev/null +++ b/doc/git-whatis/description.md @@ -0,0 +1,7 @@ +Given a git object, try to show it briefly. + +Example: + +```shell +git whatis +``` diff --git a/doc/git-whatis/git-whatis.gitconfig b/doc/git-whatis/git-whatis.gitconfig new file mode 100644 index 0000000..2fc8f76 --- /dev/null +++ b/doc/git-whatis/git-whatis.gitconfig @@ -0,0 +1,2 @@ +[alias] + whatis = "show --no-patch --pretty='tformat:%h (%s, %ad)' --date=short" diff --git a/doc/git-who/alias.txt b/doc/git-who/alias.txt new file mode 100644 index 0000000..027ac1c --- /dev/null +++ b/doc/git-who/alias.txt @@ -0,0 +1 @@ +shortlog --summary --numbered --no-merges diff --git a/doc/git-who/description.md b/doc/git-who/description.md new file mode 100644 index 0000000..40bc0b3 --- /dev/null +++ b/doc/git-who/description.md @@ -0,0 +1,7 @@ +Show a short log of who has contributed commits, in descending order. + +Example: + +```shell +git who +``` diff --git a/doc/git-who/git-who.gitconfig b/doc/git-who/git-who.gitconfig new file mode 100644 index 0000000..d99c2cb --- /dev/null +++ b/doc/git-who/git-who.gitconfig @@ -0,0 +1,2 @@ +[alias] + who = "shortlog --summary --numbered --no-merges" diff --git a/doc/git-whois/alias.sh b/doc/git-whois/alias.sh new file mode 100644 index 0000000..9ac9986 --- /dev/null +++ b/doc/git-whois/alias.sh @@ -0,0 +1,2 @@ +sh -c 'git log --regexp-ignore-case -1 --pretty="format:%an <%ae> +" --author="$1"' - diff --git a/doc/git-whois/description.md b/doc/git-whois/description.md new file mode 100644 index 0000000..557195f --- /dev/null +++ b/doc/git-whois/description.md @@ -0,0 +1,8 @@ +Given a string for an author, try to figure out full name and email. + +Example: + +```shell +git whois alice +Alice Adams +``` diff --git a/doc/git-wip-git-unwip/description.md b/doc/git-wip-git-unwip/description.md new file mode 100644 index 0000000..fc6f292 --- /dev/null +++ b/doc/git-wip-git-unwip/description.md @@ -0,0 +1,30 @@ +# git wip & git unwip + +## Aliases for "work in progress" + + +Git alias: + +```git +wip = !"git add --all; git ls-files --deleted -z | xargs -0 git rm; git commit --message=wip" + +unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1" +``` + +Example: + +```shell +git wip + +git unwip +``` + +The wip alias is a quick way to add all new and modified files to the index, +while also cleaning the index from the files removed from the working tree. +This cleaning will facilitate a rebase, because there won't be any conflict +due to an "unclean" working directory (not in sync with the index). + +The unwip alias is a quick way to restore deleted files to the working tree. + +From and VonC on stackoverflow. + diff --git a/doc/git-wip/alias.sh b/doc/git-wip/alias.sh new file mode 100644 index 0000000..0872b7f --- /dev/null +++ b/doc/git-wip/alias.sh @@ -0,0 +1 @@ +git add --all; git ls-files --deleted -z | xargs -r -0 git rm; git commit --message=wip diff --git a/doc/git-wip/description.md b/doc/git-wip/description.md new file mode 100644 index 0000000..23027c8 --- /dev/null +++ b/doc/git-wip/description.md @@ -0,0 +1,15 @@ +Alias for commit "work in progress". + +Example: + +```shell +git wip +``` + +Compare: + +* [git wip & git unwip](../git-wip-git-unwip) (overview) + +* [git wip](../git-wip) (this alias) + +* [git unwip](../git-unwip) diff --git a/dry.sh b/dry.sh new file mode 100755 index 0000000..a6a7b2a --- /dev/null +++ b/dry.sh @@ -0,0 +1,25 @@ +#! /usr/bin/env bash +set -eu + +git config --file=gitalias.txt --null --get-regexp '^alias\.' | +while read -r -d $'\n' key +do + key="${key:6}" + read -r -d $'\0' value + + mkdir -p "doc/git-${key}" + + if [[ $value == !* ]] + then + echo "${value:1}" > "doc/git-${key}/alias.sh" + else + echo "$value" > "doc/git-${key}/alias.txt" + echo -e "[alias]\n\t$key = \"$value\"" > "doc/git-${key}.gitconfig" + fi + + if [[ "$(head -n 1 "doc/git-${key}/index.md")" != "# git ${key}" ]] + then + echo "${key} : FAIL doc/git-${key}/index.md" + echo "\"$(head -n 1 "doc/git-${key}/index.md")\" != \"# git ${key}\"" + fi +done