diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 89bedcf8..a68fc302 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,6 +11,30 @@ We welcome people contributing in many ways: * Spread the word about us: http://gitalias.com +## Advice + +Typically a short alias for a command and its options +should be in the same order as the command and option words: + + * Right: `fab = foo --alpha --bravo` + + * Wrong: `baf = foo --alpha --bravo` + +Typically a short alias for a command and its options +should be using the first letter of each option word: + + * Right: `fab = foo --alpha-bravo` + + * Wrong: `fa = foo --alpha-bravo` + +One-letter aliases never use options, because we want +the aliases to be as easy as possible to compose: + + * Right: `s = status` + + * Wrong: `s = status --alpha --bravo` + + ## Conventions Conventions for coding: @@ -36,11 +60,11 @@ We want this project to be good for teams: Because we want widespread usability, we do not include everything possible: - * For example, we do not have a one-letter shortcut for `git push` + * For example, we do not have a one-letter short alias for `git push` because we have not found a widespread consensus among developers. We prefer using higher-level capabilities, such as a git hook that watches for a commit, then does an automatic push to a CI/CD server. - + * For example, we do not provide aliases for many kinds of git workflows because our research finds that each team has it's own kind of workflow. We provide a generic topic branch workflow that works well for many teams, diff --git a/README.md b/README.md index 26fbeea6..6282d3cd 100644 --- a/README.md +++ b/README.md @@ -1,430 +1,663 @@ -# Git Alias +# GitAlias -This project provides many git alias commands that you can use as you wish.. +This project provides many git alias commands that you can use as you like. Contents: -* [Introduction](#introduction) - * [What is Git Alias?](#what-is-git-alias) - * [Where is the code?](#where-is-the-code) - * [Why use this?](#why-use-this) -* [Install](#install) - * [Install with typical usage](#install-with-typical-usage) - * [Install with custom usage](#install-with-custom-usage) -* [Examples](#examples) - * [Shortcut examples](#shortcut-examples) - * [Popular examples](#popular-examples) - * [Accelerator examples](#accelerator-examples) - * [Recovery examples](#recovery-examples) - * [Coordination examples](#coordination-examples) - * [Workflow examples](#workflow-examples) - * [Optimization examples](#optimization-examples) -* [Customization](#customization) - * [Status](#status) - * [Log](#log) - * [Format](#format) -* [Contributor advice](#contributor-advice) -* [Epilog](#epilog) - * [See also](#see-also) - * [To do](#to-do) - * [Thanks](#thanks) + * [What is GitAlias?](#what-is-git-alias) + * [Download, install, customize](#download-install-customize) + * [Follow us](#follow-us) + * [Short aliases](#short-aliases) + * [Friendly aliases](#friendly-aliases) + * [Convenience alaises](#convenience-alaises) + * [Workflow aliases](#workflow-aliases) + * [Tooling aliases](#tooling-aliases) + * [Index of all aliases](#index-of-all-aliases) + * [Contribute](CONTRIBUTING.md) + * [Changes](doc/changes/index.md) + * [More ideas](doc/more/index.md) + * [To do](doc/todo/index.md) + * [Thanks](doc/thanks/index.md) + * [Tracking](#tracking) -## Introduction +## What is GitAlias? +GitAlias is a collection of git version control alias settings that can help you work faster and better. GitAlias provides short aliases such as [`s`](doc/git-s/index.md) for status, command aliases such as [`chart`](doc/git-chart/index.md) and [`churn`](doc/git-churn/index.md), lookup aliases such as [`whois`](doc/git-who/index.md) and [`whatis`](doc/git-whatis/index.md), workflow aliases such as [`topic-begin`](doc/git-topic-begin/index.md) for feature branch development, and more. -### What is Git Alias? -Git Alias is a collection of git version control shortcuts, functions, and commands: +## Download, install, customize - * Shortcuts such as `s` for `status`. +You can use GitAlias various ways: - * Improvements such as `optimize` to do a prune and repack with recommended settings. + * Download GitAlias code in one file: [gitalias.txt](gitalias.txt) - * Workflows such as `topic-start` to create a new topic branch for a new feature. + * Install GitAlias using a variety of ways: [install guide](doc/install/index.md). - * Visualizations such as `graphviz` to show logs and charts using third-party tools. + * Customize the aliases as you wish: [customize guide](doc/customize/index.md). -### Where is the code? +## Follow us -To see the complete code, view this file: +You can follow us on GitHub: - * [gitalias.txt](gitalias.txt) + * GitAlias account: [https://github.com/gitalias](https://github.com/gitalias) + * GitAlias repository: [https://github.com/gitalias/gitalias](https://github.com/gitalias/gitalias) -### Why use this? -We are creating this alias list because we type these commands many times daily, and we want the commands to be fast and also accurate. +## Short aliases -We often work on teams, across many companies and organizations, and using multiple shells. We want to count on a set of aliases. For shorter commands, such as `s` for `status`, fast speed is nice. For longer commands, such as `repacker`, accurate settings are important. +Short aliases are for frequent commands and options: +git add: + * [git a](doc/git-a/index.md) = add + * [git aa](doc/git-aa/index.md) = add --all + * [git ap](doc/git-ap/index.md) = add --patch + * [git au](doc/git-au/index.md) = add --update -## Install +git branch: + * [git b](doc/git-b/index.md) = branch + * [git bm](doc/git-bm/index.md) = branch --merged + * [git bnm](doc/git-bnm/index.md) = branch --no-merged + * [git bed](doc/git-bed/index.md) = branch --edit-description + * [git bsd](doc/git-bsd/index.md) = branch --show-description (polyfill) -### Install with typical usage +git commit: -Download the file [`gitalias.txt`](gitalias.txt) and include it: + * [git c](doc/git-c/index.md) = commit + * [git ca](doc/git-ca/index.md) = commit --amend + * [git cam](doc/git-cam/index.md) = commit --amend --message + * [git cane](doc/git-cane/index.md) = commit --amend --no-edit + * [git ci](doc/git-ci/index.md) = commit --interactive + * [git cm](doc/git-cm/index.md) = commit --message -```sh -curl https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt -o ~/.gitalias -git config --global include.path ~/.gitalias -``` +git checkout: + * [git co](doc/git-co/index.md) = checkout + * [git cog](doc/git-cog/index.md) = checkout --guess + * [git cong](doc/git-cong/index.md) = checkout --no-guess -### Install with custom usage +git cherry-pick: -Download the file [`gitalias.txt`](gitalias.txt) any way you want, such as: + * [git cp](doc/git-cp/index.md) = cherry-pick + * [git cpa](doc/git-cpa/index.md) = cherry-pick --abort + * [git cpc](doc/git-cpc/index.md) = cherry-pick --continue + * [git cpn](doc/git-cpn/index.md) = cherry-pick -n (--no-commit) + * [git cpnx](doc/git-cpnx/index.md) = cherry-pick -n -x (--no-commit and with a message) -```sh -curl -O https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt -``` +git diff: -Manually edit your git config dot file any way you want, such as: + * [git d](doc/git-d/index.md) = diff + * [git dd](doc/git-dd/index.md) = diff with our preferred settings + * [git dc](doc/git-dc/index.md) = diff --cached + * [git ds](doc/git-ds/index.md) = diff --staged + * [git dwd](doc/git-dwd/index.md) = diff --word-diff -```sh -vi ~/.gitconfig -``` +git fetch: -Include the path to this file: + * [git f](doc/git-f/index.md) = fetch -```toml -[include] -path = ~/.gitalias -``` +git grep: + * [git g](doc/git-g/index.md) = grep + * [git gg](doc/git-gg/index.md) = grep with our preferred settings + * [git gn](doc/git-gn/index.md) = grep -n (--line-number) -## Examples +git log: + * [git l](doc/git-l/index.md) = log + * [git ll](doc/git-ll/index.md) = log list with our preferred short settings + * [git lll](doc/git-lll/index.md) = log list with our preferred long settings + * [git lg](doc/git-lg/index.md) = log --graph + * [git lo](doc/git-lo/index.md) = log --oneline + * [git lor](doc/git-lor/index.md) = log --oneline --reverse + * [git lp](doc/git-lp/index.md) = log --patch + * [git lfp](doc/git-lfp/index.md) = log --first-parent + * [git lto](doc/git-lto/index.md) = log --topo-order -### Shortcut examples +git ls-files: -Letters: + * [git ls](doc/git-ls/index.md) = ls-files + * [git lsd](doc/git-lsd/index.md) = ls-files --debug + * [git lsfn](doc/git-lsfn/index.md) = ls-files --full-name + * [git lsio](doc/git-lsio/index.md) = ls-files --ignored --others --exclude-standard -```gitalias -a = add +git merge: -b = branch + * [git m](doc/git-m/index.md) = merge + * [git ma](doc/git-ma/index.md) = merge --abort + * [git mc](doc/git-mc/index.md) = merge --continue + * [git mncnf](doc/git-mncnf/index.md) = merge --no-commit --no-ff -c = commit -``` +git pull: -Letters with options: + * [git pf](git-pf/index.md) = pull --ff-only + * [git pr](git-pr/index.md) = pull --rebase + * [git prp](git-prp/index.md) = pull --rebase=preserve -```gitalias -ap = add --patch +git rebase: -bm = branch --merged + * [git rb](doc/git-rb/index.md) = rebase + * [git rba](doc/git-rb/index.md) = rebase --abort + * [git rbc](doc/git-rbc/index.md) = rebase --continue + * [git rbs](doc/git-rbs/index.md) = rebase --skip + * [git rbi](doc/git-rbi/index.md) = rebase --interactive + * [git rbiu](doc/git-rbiu/index.md) = rebase --interactive @{upstream} -ci = commit --interactive -``` +git reflog: + * [git rl](doc/git-rl/index.md) = reflog -### Popular examples +git remote: -Summarizing: + * [git rr](doc/git-rr/index.md) = remote + * [git rrs](doc/git-rrs/index.md) = remote show + * [git rru](doc/git-rru/index.md) = remote update + * [git rrp](doc/git-rrp/index.md) = remote prune -```gitalias -dd = diff --check --dirstat --find-copies --find-renames --histogram --color +git revert: -ll = log --graph --topo-order --abbrev-commit --date=short --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' -``` + * [git rv](doc/git-rv/index.md) = revert + * [git rvnc](doc/git-rvnc/index.md) = revert --no-commit -Committing: +git show-branch: -```gitalias -cam = commit --amend --message + * [git sb](doc/git-sb/index.md) = show-branch + * [git sbdo](doc/git-sbdo/index.md) = show-branch --date-order + * [git sbto](doc/git-sbto/index.md) = show-branch --topo-order -rbi = rebase --interactive @{upstream} -``` +git submodule: + * [git sm](doc/git-sm/index.md) = submodule + * [git smi](doc/git-smi/index.md) = submodule init + * [git sma](doc/git-sma/index.md) = submodule add + * [git sms](doc/git-sms/index.md) = submodule sync + * [git smu](doc/git-smu/index.md) = submodule update + * [git smui](doc/git-smui/index.md) = submodule update --init + * [git smuir](doc/git-smuir/index.md) = submodule update --init --recursive -### Accelerator examples +git status: -Logging: + * [git s](doc/git-s/index.md) = status + * [git ss](doc/git-ss/index.md) = status --short + * [git ssb](doc/git-ssb/index.md) = status --short --branch -```gitalias -log-graph = log --graph --all --decorate --oneline +git whatchanged: -log-my-week = !git log --author $(git config user.email) --since "1 week ago" -``` + * [git w](doc/git-w/index.md) = whatchanged -Searching: -```gitalias -grep-group = grep --break --heading --line-number +## Friendly aliases -grep-all = !"git rev-list --all | xargs git grep '$1'" -``` +Recommended helpers: + * [git initer](doc/git-initer/index.md) - Initialize a repo using our recommended way i.e. with an empty rebaseable commit + * [git cloner](doc/git-cloner/index.md) - Clone a repo using our recommended way i.e. recursive include of submodules + * [git pruner](doc/git-pruner/index.md) - Prune a repo using our recommnded way i.e. prune everything unreachable now + * [git repacker](doc/git-repacker/index.md) - Repack a repo our recommended way i.e. as Linus Torvalds describes + * [git optimizer](doc/git-optimizer/index.md) - Optimize a repo using our recommended way i.e. by pruning and repacking -### Recovery examples +Quick highlights: -Backtracking: + * [git chart](doc/git-chart/index.md) + * [git churn](doc/git-churn/index.md) + * [git summary](doc/git-summary/index.md) -```gitalias -uncommit = reset --soft HEAD~1 +Branch names: -cleanout = !git clean -df && git checkout -- . -``` + * [git default-branch](doc/git-default-branch/index.md) - Show the default branch name + * [git current-branch](doc/git-current-branch/index.md) - Show the current branch name + * [git upstream-branch](doc/git-upstream-branch/index.md) - Show the upstream branch name + * [git topic-base-branch](doc/git-topic-base-branch/index.md) - Show the topic base branch name -Preserving: +Branch commits: -```gitalias -snapshot = !git stash push "snapshot: $(date)" && git stash apply "stash@{0}" + * [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) -archive = !"f() { top=$(rev-parse --show-toplevel); cd $top; tar cvf $top.tar $top ; }; f" -``` +Friendly plurals: + * [git aliases](doc/git-aliases/index.md) - List aliases + * [git branches](doc/git-branches/index.md) - List branches + * [git tags](doc/git-tags/index.md) - List tags + * [git stashes](doc/git-stashes/index.md) - List stashes -### Traversal examples +Undo: -Find the branch's previous commit hash: + * [git uncommit](doc/git-uncommit/index.md) = reset --soft HEAD~1 + * [git unadd](doc/git-unadd/index.md) = reset HEAD -```gitalias -git branch-commit-prev -``` +Logging & reporting: -Find the branch's next commit hash: + * [git log-*](doc/git-log/index.md) (many aliases) + * [git who](doc/git-who/index.md) -```gitalias -git branch-commit-next -``` +Lookups: + * [git whois](doc/git-whois/index.md) - Try to figure out an author's information + * [git whatis](doc/git-whatis/index.md) - Try to figure out an object's information -### Coordination examples +Commit details: -Combining: + * [git commit-parents](doc/git-commit-parents/index.md) - Show the commit's parents + * [git commit-is-merge](doc/git-commit-is-merge/index.md) - Is the commit a merge commit? + * [git commit-message-key-lines](doc/git-commit-message-key-lines/index.md) -```gitalias -ours = !"f() { git checkout --ours $@ && git add $@; }; f" +Add all & edit all: -theirs = !"f() { git checkout --theirs $@ && git add $@; }; f" -``` + * [git add-*](doc/git-edit/index.md) - Add all files of a given type + * [git edit-*](doc/git-edit/index.md) - Edit all files of a given type -Comparing: +Alias helpers: -```gitlias -incoming = !git remote update --prune; git log ..@{upstream} + * [git add-alias](doc/git-add-alias/index.md) - Create a new git alias + * [git move-alias](doc/git-move-alias/index.md) - Rename an existing git alias -outgoing = log @{upstream}.. -``` +Script helpers: + * [git top](doc/git-top/index.md) - Get the top level directory name + * [git exec](doc/git-exec/index.md) - Execute a shell script -### Workflow examples +Remotes: -Synchronizing: + * [git remotes-prune](doc/git-remotes-prune/index.md) - For each remote branch, prune it + * [git remotes-push](doc/git-remotes-push/index.md) - For each remote branch, push it -```gitalias -get = !git fetch --prune && git pull --rebase=preserve && git submodule update --init --recursive +New repos: -put = !git commit --all && git push -``` + * [git init-empty](doc/git-init-empty/index.md) - Initialize a repo with an empty rebaseable commit + * [git clone-lean](doc/git-clone-lean/index.md) - Clone a repo as lean as possible -Publishing: +Hew branches: -```gitalias -publish = "!git push -u origin $(git current-branch)" + * [git hew](doc/git-hew/index.md) - Delete all branches that are merged into a commit + * [git hew-dry-run](doc/git-hew/index.md) - Delete all branches that are merged into a commit (dry run) + * [git hew-local](doc/git-hew-local/index.md) - Delete local branches that are merged into a commit + * [git hew-local-dry-run](doc/git-hew-local/index.md) - Delete local branches that are merged (dry run) + * [git hew-remote](doc/git-hew-remote/index.md) - Delete remote branches that are merged into a commit + * [git hew-remote-dry-run](doc/git-hew-remote-dry-rn/index.md) - Delete remote branches that are merged into a commit (dry run) -unpublish = "!git push origin :$(git current-branch)" -``` +Saving work: -Branching: + * [git archive](doc/git-archive/index.md) - Create an archive file of everything in the repo + * [git snapshot](doc/git-snapshot/index.md) - Stash a snapshot of your current working tree + * [git panic](doc/git-panic/index.md) - When you're worried the world is coming to an end -```gitalias -topic-start = "!f(){ b=$1; git checkout main; git fetch; git rebase; git checkout -b "$b" main; };f" +Misc: -topic-stop = "!f(){ b=$1; git checkout main; git branch -d "$b"; git push origin ":$b"; };f" -``` + * [git init-empty](doc/git-init-empty/index.md) - Initialize a repo with an empty rebaseable commit + * [git diff-*](doc/git-diff/index.md) + * [git grep-*](doc/git-grep/index.md) + * [git merge-span-*](doc/git-merge-span/index.md) - Merge span aliases + * [git orphans](doc/git-orphans/index.md) - Find all objects that aren't referenced by any other object + * [git fixup](doc/git-fixup/index.md) - Fix a commit by amending it + * [git rev-list-all-objects-by-size](doc/git-rev-list-all-objects-by-size/index.md) + * [git rev-list-all-objects-by-size-and-name](doc/git-rev-list-all-objects-by-size-and-name/index.md) + * [git cherry-pick-merge](doc/git-cherry-pick-merge/index.md) + * [git refs-by-date](doc/git-refs-by-date/index.md) - Sort by date for branches +Advanced aliases: -### Optimization examples + * [git search-commits](doc/git-search-commits/index.md) + * [git debug](doc/git-debug/index.md) + * [git intercommit](doc/git-intercommit/index.md) -Naming: -```gitalias -top-name = rev-parse --show-toplevel +## Workflow aliases -branch-name = rev-parse --abbrev-ref HEAD +Topic branching for feature workflows: -upstream-name = !git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD) -``` + * [git topic-*](doc/git-topic/index.md) - Read this first about topic aliases. + * [git topic-base-branch](doc/git-topic-base-branch/index.md) - Show the topic base branch name + * [git topic-begin](doc/git-topic-begin/index.md) - Start a new topic branch + * [git topic-end](doc/git-topic-end/index.md) - Finish the current topic branch + * [git topic-sync](doc/git-topic-sync/index.md) - Synchronize the current topic branch + * [git topic-move](doc/git-topic-move/index.md) - Rename the current topic branch -Pluralizing: +Flow aliases: -```gitalias -branches = branch -a + * [git get & git put](doc/git-get-git-put/index.md) + * [git ours & git theirs](doc/git-ours-git-theirs/index.md) + * [git wip & git unwip](doc/git-wip-git-unwip/index.md) + * [git assume & git unassume](doc/git-assume-and-git-unassume/index.md) + * [git publish & git unpublish](doc/git-publish-git-unpublish/index.md) -stashes = stash list +reset & undo: -tags = tag -n1 --list -``` + * [git reset-*](doc/git-reset/index.md) - Move backwards on the commit chain; synonym for undo-* + * [git undo-*](doc/git-undo/index.md) - Move backwards on the commit chain; synonym for reset-* -Streamlining: +track & untrack: -```gitalias -pruner = !git prune --expire=now; git reflog expire --expire-unreachable=now --rewrite --all - -repacker = !git repack -a -d -f --depth=300 --window=300 --window-memory=1g - -expunge = !"f() { git filter-branch --force --index-filter \"git rm --cached --ignore-unmatch $1\" --prune-empty --tag-name-filter cat -- --all }; f" -``` - - -## Customization - - -If you want to use this file, and also want to change some of the items, -then one way is to use your git config file to include this gitalias file, -and also define your own alias items; a later alias takes precedence. - -This section has examples that include this file, then add a customization. - - -### Status - -To do your own custom terse status messages: - -```gitalias -[include] -path = ~/.gitalias -[alias] -s = status -sb -``` - - -### Log - -To do your own custom log summaries: - -```gitalias -[include] -path = ~/.gitalias - -[alias] -l = log --graph --oneline -``` - -### Format - -To do your own custom pretty formatting: - -```gitalias -[include] -path = ~/.gitalias - -[format] -pretty = "%H %ci %ce %ae %d %s" -``` - - -## Contributor advice - -Typically a short alias for a command and its options -is in the same order as the command and option words: - - * Right: `fab = foo --alpha --bravo` - - * Wrong: `baf = foo --alpha --bravo` - - * Wrong: `abf = foo --alpha --bravo` - -Typically a short alias for a command and its options -uses the first letter of each option word: - - * Right: `fab = foo --alpha-bravo` - - * Wrong: `fa = foo --alpha-bravo` - - * Wrong: `fb = foo --alpha-bravo` - - -## Epilog - - -### See also - -More ideas for git improvements: - - * If you want to alias the git command, then use your shell, such as `alias g=git`. - - * If you want history views, see [git-recall](https://github.com/Fakerr/git-recall) - - * If you use `oh-my-zsh`, then you may like the git [plugin](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git) - - * If you use `vim` then see [Fugitive](https://github.com/tpope/vim-fugitive) - - * If you use `emacs` then see [Magit](https://magit.vc/) - - * If you use git shell scripting then see [SCM Breeze](https://github.com/ndbroadbent/scm_breeze) - - * If you use `node` then see [git-alias](https://www.npmjs.com/package/git-alias) - -For more git config ideas, and for credit for many of the aliases here, please see these excelent resources: - - * - - * - - * - - * - - * - - * - - * - - * - - * - - * [Human Git Aliases](http://gggritso.com/human-git-aliases) - -References: - - * [Git Basics - Git Aliases](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases) - - * [Git Basics - Tips and Tricks](https://git-scm.com/book/en/v1/Git-Basics-Tips-and-Tricks) - - - - - - -### Thanks - -Thanks to all the contributors, including all the creators of the projects mentioned above. - -Thanks to these people for extra help, in alphabetic order: - - * [Alberto Gregorio](https://github.com/marsop) - * [Berkin Berkcan Çırak](https://github.com/berkin) - * [Bill Lazar](https://github.com/billsaysthis) - * [Corey Haines](http://coreyhaines.com/) - * [Erik Martin-Dorel](https://github.com/erikmd) - * [Gareth Owen](https://github.com/gwjo) - * [Gary Bernhardt](http://destroyallsoftware.com) - * [Jeff Wu](https://github.com/WuTheFWasThat) - * [Joe Nelson](http://begriffs.com) - * [Joe Nelson](https://github.com/begriffs) - * [Joel Parker Henderson](https://github.com/joelparkerhenderson) - * [Kobus Jooste](https://github.com/kobusjooste) - * [Michael Mior](https://github.com/michaelmior) - * [Michal Jarosz](https://github.com/Mchl) - * [Mislav Marohnić](http://mislav.uniqpath.com/) - * [Nariyasu Heseri](https://github.com/NariyasuHeseri) - * [Nick Kirby](https://github.com/NRKirby) - * [Nick Palmer](https://github.com/nickpalmer) - * [Oleg Broytman](https://github.com/phdru) - * [Rob Kennedy](http://cs.wisc.edu/~rkennedy) - * [Rob Miller](https://github.com/robmiller) - * [Romain Dartigues](https://github.com/romain-dartigues) - * [Ruben Verborgh](http://ruben.verborgh.org) - * [Scott Lindsay](http://stackoverflow.com/users/167384/scott-lindsay) - * [Tsukasa Noguchi](https://github.com/wild-mouse) - * [YantaoZhao](https://github.com/yantaozhao) - * [baudtack](http://baudtack.com) + * [git track](doc/git-track/index.md) - Start tracking from a local branch to upstream branch + * [git untrack](doc/git-untrack/index.md) - Stop tracking from a local branch to upstream branch + +inbound & outbound: + + * [git inbound](doc/git-inbound/index.md) - Show incoming changes compared to upstream + * [git outbound](doc/git-outbound/index.md) - Show outgoing changes compared to upstream + +pull1 & push1: + + * [git pull1](doc/git-pull1/index.md) - Pull just the current branch + * [git push1](doc/git-push1/index.md) - Push just the current branch + +Misc: + + * [git issues](doc/git-issues/index.md) - Show issues that are described in commit messages + * [git expunge](doc/git-expunge/index.md) - Use filter-branch to delete a file everywhere + * [git reincarnate](doc/git-reincarnate/index.md) - Kill a branch then create it anew + * [git diff-chunk](doc/git-diff-chunk/index.md) - Do a diff of two chunks in revisions + * [git last-tag](doc/git-last-tag/index.md) - Show the last tag in the current branch + * [git serve](doc/git-serve/index.md) - Serve the local directory via git server daemon + * [git track-all-remote-branches](doc/git-track-all-remote-branches/index.md) - Track all remote branches + * [git cleaner](doc/git-cleaner/index.md) - Clean a working tree using more power options + * [git cleanest](doc/git-cleanest/index.md) - Clean a working tree using the most power options + * [git cleanout](doc/git-cleanout/index.md) - Clean a working tree using typical options then checkout + + +## Tooling aliases + +Use gitk: + + * [git gitk-conflict](doc/git-gitk-conflict/index.md) - Use gitk to show conflicting merge + * [git gitk-history-all](doc/git-history-all/index.md) - Use gitk to show full history + +Use other version control systems: + + * [git cvs-*](doc/git-cvs/index.md) - Use CVS version control + * [git svn-*](doc/git-svn/index.md) - Use Subversion version control + +Use graphviz: + + * [git graphviz](doc/git-graphviz/index.md) - Use graphviz for display + + +## Index of all aliases + + * [git a](doc/git-a/index.md) - Short for "git add" + * [git aa](doc/git-aa/index.md) - Short for "git add --all" - Add all paths + * [git add-alias](doc/git-add-alias/index.md) - Create a new git alias + * [git add-cached](doc/git-add-cached/index.md) - Add cached files + * [git add-deleted](doc/git-add-deleted/index.md) - Add deleted files + * [git add-ignored](doc/git-add-ignored/index.md) - Add ignored files + * [git add-killed](doc/git-add-killed/index.md) - Add killed files + * [git add-modified](doc/git-add-modified/index.md) - Add modified files + * [git add-others](doc/git-add-others/index.md) - Add other files + * [git add-stage](doc/git-add-stage/index.md) - Add stage files + * [git add-unmerged](doc/git-add-unmerged/index.md) - Add unmerged files + * [git aliases](doc/git-aliases/index.md) - List git aliases + * [git ap](doc/git-ap/index.md) - Short for "git add --patch" - Add by patch + * [git archive](doc/git-archive/index.md) - Create an archive file of everything in the repo + * [git assume-all](doc/git-assume-all/index.md) - Assume all files are unchanged + * [git assume](doc/git-assume/index.md) - Assume files are unchanged + * [git assumed](doc/git-assumed/index.md) - Show which files are assumed + * [git au](doc/git-au/index.md) - Short for "git add --update" + * [git b](doc/git-b/index.md) - Short for "git branch" + * [git bed](doc/git-bed/index.md) - Edit the description of a branch + * [git bm](doc/git-bm/index.md) - List branches whose tips are reachable from the specified commit (HEAD if not specified) + * [git bnm](doc/git-bnm/index.md) - List branches whose tips are not reachable from the specified commit (HEAD if not specified) + * [git branch-commit-first](doc/git-branch-commit-first/index.md) - Show a branch's first commit hash (or hashes) + * [git branch-commit-last](doc/git-branch-commit-last/index.md) - Show a branch's last commit hash (or hashes) + * [git branch-commit-next](doc/git-branch-commit-next/index.md) - Show a branch's next commit hash (or hashes) + * [git branch-commit-prev](doc/git-branch-commit-prev/index.md) - Show a branch's previous commit hash (or hashes) + * [git branch](doc/git-branch/index.md) - Aliases related to git branch + * [git branches](doc/git-branches/index.md) - List branches + * [git bsd](doc/git-bsd/index.md) - Show the description of a branch + * [git bv](doc/git-bv/index.md) - List branch information with hash and subject + * [git bvv](doc/git-bvv/index.md) - List branch information with hash and subject and upstream + * [git c](doc/git-c/index.md) - Short for "git commit" + * [git ca](git-ca) - Amend the tip of the current branch; do not create a new commit + * [git cam](git-cam) - Amend the tip of the current branch; edit the message + * [git cane](doc/git-cane/index.md) - Amend the tip of the current branch; do not edit the message + * [git chart](doc/git-chart/index.md) - Show a summary chart of activity per author + * [git cherry-pick-merge](doc/git-cherry-pick-merge/index.md) - Cherry pick a merge commit + * [git churn](doc/git-churn/index.md) - Show log of files that have many changes + * [git ci](doc/git-ci/index.md) - Commit interactive + * [git cleaner](doc/git-cleaner/index.md) - Clean a working tree using more power options + * [git cleanest](doc/git-cleanest/index.md) - Clean a working tree using the most power options + * [git cleanout](doc/git-cleanout/index.md) - Clean a working tree using typical options then checkout + * [git clone-lean](doc/git-clone-lean/index.md) - Clone as lean as possible + * [git cloner](doc/git-cloner/index.md) - Clone a repository and recurse on any of its submodules + * [git cm](doc/git-cm/index.md) - Commit with a message + * [git co](doc/git-co/index.md) - Checkout a.k.a. update the working tree to match a branch or paths + * [git commit-is-merge](doc/git-commit-is-merge/index.md) - Is the commit a merge commit? If yes exit 0, else exit 1 + * [git commit-message-key-lines](doc/git-commit-message-key-lines/index.md) - Show the commit's keyword-marker lines + * [git commit-parents](doc/git-commit-parents/index.md) - Show the commit's parents + * [git cong](doc/git-cong/index.md) - Checkout with no guessing + * [git count](doc/git-count/index.md) - + * [git cp](doc/git-cp/index.md) - Cherry-pick - apply the changes introduced by some existing commits; + * [git cpa](doc/git-cpa/index.md) - Abort the cherry-pick process + * [git cpc](doc/git-cpc/index.md) - Continue the cherry-pick process + * [git cpn](doc/git-cpn/index.md) - Cherry-pick with no commit + * [git cpnx](doc/git-cpnx/index.md) - Cherry-pick with no commit and with explanation + * [git current-branch](doc/git-current-branch/index.md) - Get the current branch name + * [git hew](doc/git-hew/index.md) - Delete branches that have been merged into a commit + * [git hew-dry-run](doc/git-hew-dry-run/index.md) - Delete branches that have been merged into a commit (dry run) + * [git hew-local](doc/git-hew-local/index.md) - Delete local branches that have been merged into a commit + * [git hew-local-dry-run](doc/git-hew-local-dry-run/index.md) - Delete local branches that have been merged into a commit (dry run) + * [git hew-remote](doc/git-hew-remote/index.md) - Delete remote branches that have been merged into an upstream commit + * [git hew-remote-dry-run](doc/git-hew-remote-dry-run/index.md) - Delete remote branches that have been merged into an upstream commit (dry run) + * [git cvs-e](doc/git-cvs-e/index.md) - CVS export + * [git cvs-i](doc/git-cvs-i/index.md) - CVS import + * [git d](doc/git-d/index.md) - Short for "git diff" + * [git dc](doc/git-dc/index.md) - Diff in order to show changes not yet staged + * [git dd](doc/git-dd/index.md) - Diff deep - show changes with our preferred options + * [git debug](doc/git-debug/index.md) - Help debugging builtins + * [git default-branch](doc/git-default-branch/index.md) - Get the default branch name + * [git diff-all](doc/git-diff-all/index.md) - For each diff, call difftool + * [git diff-changes](doc/git-diff-changes/index.md) - Show diff of changes + * [git diff-chunk](doc/git-diff-chunk/index.md) - Show the diff of one chunk + * [git diff-deep](doc/git-diff-deep/index.md) - Diff with deep information using our preferred options, a.k.a. `dd` + * [git diff-staged](doc/git-diff-staged/index.md) - Show diffs that are cached i.e. staged + * [git diff-stat](doc/git-diff-stat/index.md) - Diff with stat + * [git discard](doc/git-discard/index.md) - Discard changes in a file (or a list of files) in working tree + * [git ds](doc/git-ds/index.md) - Show changes about to be commited + * [git dw](doc/git-dw/index.md) - Show changes by word, not line + * [git edit-cached](doc/git-edit-cached/index.md) - Edit cached files + * [git edit-deleted](doc/git-edit-deleted/index.md) - Edit deleted files + * [git edit-ignored](doc/git-edit-ignored/index.md) - Edit ignored files + * [git edit-killed](doc/git-edit-killed/index.md) - Edit killed files + * [git edit-modified](doc/git-edit-modified/index.md) - Edit modified files + * [git edit-others](doc/git-edit-others/index.md) - Edit other files + * [git edit-stage](doc/git-edit-stage/index.md) - Edit stage files + * [git edit-unmerged](doc/git-edit-unmerged/index.md) - Edit unmerged files + * [git exec](doc/git-exec/index.md) - Execute a shell script + * [git expunge](doc/git-expunge/index.md) - Delete a file everywhere + * [git f](doc/git-f/index.md) - Short for "git fetch" + * [git fa](doc/git-fa/index.md) - Fetch all remotes + * [git fav](doc/git-fav/index.md) - Fetch all remotes, with verbose output + * [git fixup](doc/git-fixup/index.md) - Fix a commit by amending it + * [git g](doc/git-g/index.md) - Short for "git grep" + * [git get](doc/git-get/index.md) - Get all changes for the current branch + * [git gg](doc/git-gg/index.md) - Grep group i.e. search with our preferred options + * [git gitk-conflict](doc/git-gitk-conflict/index.md) - Use gitk tool to show conflicting merge + * [git gitk-history-all](doc/git-gitk-history-all/index.md) - Use gitk tool to show full history + * [git gn](doc/git-gn/index.md) - Grep and show line number + * [git graphviz](doc/git-graphviz/index.md) - Use graphviz tool for display + * [git grep-ack](doc/git-grep-ack/index.md) - + * [git grep-all](doc/git-grep-all/index.md) - Find text in any commit ever + * [git grep-group](doc/git-grep-group/index.md) - Find text and group the output lines, a.k.a. `gg` + * [git heads](doc/git-heads/index.md) - Show log of heads + * [git ignore](doc/git-ignore/index.md) - Ignore all untracked files by appending them to ".gitignore" + * [git inbound](doc/git-inbound/index.md) - Show incoming changes compared to upstream + * [git init-empty](doc/git-init-empty/index.md) - Initalize a repo with an empty rebaseable commit + * [git initer](doc/git-initer/index.md) - Initalize a repo using our recommended way i.e. with an empty rebaseable commit + * [git intercommit](doc/git-intercommit/index.md) - Use interdiff to see patch modifications + * [git issues](doc/git-issues/index.md) - List all issues mentioned in commit messages between range of commits + * [git l](doc/git-l/index.md) - Short for "git log" + * [git last-tag](doc/git-last-tag/index.md) - Show the last tag in the current branch + * [git last-tagged](doc/git-last-tagged/index.md) - Show the last annotated tag in all branches + * [git lfp](doc/git-lfp/index.md) - Show log with first parent + * [git lg](doc/git-lg/index.md) - Show log with a text-based graphical representation of the commit history + * [git ll](doc/git-ll/index.md) - Log list - Show log list with our preferred options and short information + * [git lll](doc/git-lll/index.md) - Log list long - Show log list with our preferred options and long information + * [git lo](doc/git-lo/index.md) - Show log with one line per item + * [git log-1-day](doc/git-log-1-day/index.md) - Show log with the recent day + * [git log-1-hour](doc/git-log-1-hour/index.md) - Show log with the recent hour + * [git log-1-month](doc/git-log-1-month/index.md) - Show log with the recent month + * [git log-1-week](doc/git-log-1-week/index.md) - Show log with the recent week + * [git log-1-year](doc/git-log-1-year/index.md) - Show log with the recent year + * [git log-date-first](doc/git-log-date-first/index.md) - Show the date of the earliest commit, in strict ISO 8601 format + * [git log-date-last](doc/git-log-date-last/index.md) - Show the date of the latest commit, in strict ISO 8601 format + * [git log-fetched](doc/git-log-fetched/index.md) - Show log of fetched commits vs. origin/main + * [git log-fresh](doc/git-log-fresh/index.md) - Show log of new commits after you fetched, with stats, excluding merges + * [git log-graph](doc/git-log-graph/index.md) - + * [git log-list](doc/git-log-list/index.md) - Show log list with our preferred options and short information + * [git log-list-long](doc/git-log-list-long/index.md) - Show log list with our preferred options and long information + * [git log-my](doc/git-log-my/index.md) - Show log with my own commits by my own user email + * [git log-my-day](doc/git-log-my-day/index.md) - Show log with my own recent day + * [git log-my-hour](doc/git-log-my-hour/index.md) - Show log with my own recent hour + * [git log-my-month](doc/git-log-my-month/index.md) - Show log with my own recent month + * [git log-my-week](doc/git-log-my-week/index.md) - Show log with my own recent week + * [git log-my-year](doc/git-log-my-year/index.md) - Show log with my own recent year + * [git log-of-count-and-day](doc/git-log-of-count-and-day/index.md) - Show log with count and day + * [git log-of-count-and-day-of-week](doc/git-log-of-count-and-day-of-week/index.md) - Show log with count and day of week + * [git log-of-count-and-email](doc/git-log-of-count-and-email/index.md) - Show log with count and email + * [git log-of-count-and-format](doc/git-log-of-count-and-format/index.md) - Show log with count and custom format string + * [git log-of-count-and-format-with-date](doc/git-log-of-count-and-format-with-date/index.md) - Show log with count and custom format string and date + * [git log-of-count-and-hour](doc/git-log-of-count-and-hour/index.md) - Show log with count and hour + * [git log-of-count-and-hour-of-day](doc/git-log-of-count-and-hour-of-day/index.md) - Show log with count and hour of day + * [git log-of-count-and-month](doc/git-log-of-count-and-month/index.md) - Show log with count and month + * [git log-of-count-and-week](doc/git-log-of-count-and-week/index.md) - Show log with count and week + * [git log-of-count-and-week-of-year](doc/git-log-of-count-and-week-of-year/index.md) - Show log with count and week of year + * [git log-of-count-and-year](doc/git-log-of-count-and-year/index.md) - Show log with count and year + * [git log-of-day-and-count](doc/git-log-of-day-and-count/index.md) - Show log with day and count + * [git log-of-day-of-week-and-count](doc/git-log-of-day-of-week-and-count/index.md) - Show log with week and count + * [git log-of-email-and-count](doc/git-log-of-email-and-count/index.md) - Show log with email and count + * [git log-of-format-and-count](doc/git-log-of-format-and-count/index.md) - Show a specific format string and count of log entries + * [git log-of-format-and-count-with-date](doc/git-log-of-format-and-count-with-date/index.md) - Show log with custom format string and count with date + * [git log-of-hour-and-count](doc/git-log-of-hour-and-count/index.md) - Show log with hour and count + * [git log-of-hour-of-day-and-count](doc/git-log-of-hour-of-day-and-count/index.md) - Show log with hour of day and count + * [git log-of-month-and-count](doc/git-log-of-month-and-count/index.md) - Show log with month and count + * [git log-of-week-and-count](doc/git-log-of-week-and-count/index.md) - Show log with week and count + * [git log-of-week-of-year-and-count](doc/git-log-of-week-of-year-and-count/index.md) - Show log with week of year and count + * [git log-of-year-and-count](doc/git-log-of-year-and-count/index.md) - Show log with year and count + * [git log-refs](doc/git-log-refs/index.md) - Show log with commits that are referred by some branch or tag + * [git log-timeline](doc/git-log-timeline/index.md) - + * [git lp](doc/git-lp/index.md) - Show log with patch generation + * [git ls](doc/git-ls/index.md) - List files in the index and the working tree; like Unix "ls" command + * [git lsd](doc/git-lsd/index.md) - List files and show debug information + * [git lsfn](doc/git-lsfn/index.md) - List files and show full name + * [git lsio](doc/git-lsio/index.md) - List files that git is ignoring + * [git lto](doc/git-lto/index.md) - Show log with items appearing in topological order + * [git m](doc/git-m/index.md) - Short for "git merge" + * [git ma](doc/git-ma/index.md) - Merge abort i.e. abort the merge process + * [git mainly](doc/git-mainly/index.md) - Make local like main + * [git mc](doc/git-mc/index.md) - Merge continue i.e. continue the merge process + * [git mncnf](doc/git-mncnf/index.md) - Merge with no autocommit, and with no fast-forward + * [git merge-span](doc/git-merge-span/index.md) - Merge span aliases + * [git merge-span-diff](doc/git-merge-span-diff/index.md) - Show the changes that were introduced by a merge + * [git merge-span-difftool](doc/git-merge-span-difftool/index.md) - Show the changes that were introduced by a merge, in your difftool + * [git merge-span-log](doc/git-merge-span-log/index.md) - Find the commits that were introduced by a merge + * [git move-alias](doc/git-move-alias/index.md) - Rename an existing git alias + * [git o](doc/git-o/index.md) - Short for "git checkout" + * [git optimizer](doc/git-optimizer/index.md) - Optimize the repository by pruning and repacking + * [git orphans](doc/git-orphans/index.md) - Find all objects that aren't referenced by any other object + * [git ours](doc/git-ours/index.md) - Checkout our version of a file and add it + * [git outbound](doc/git-outbound/index.md) - Show outgoing changes compared to upstream + * [git p](doc/git-p/index.md) - Short for "git pull" + * [git panic](doc/git-panic/index.md) - When you're a little worried that the world is coming to an end + * [git pf](doc/git-pf/index.md) - Pull if a merge can be resolved as a fast-forward, otherwise fail + * [git pr](doc/git-pr/index.md) - Pull with rebase i.e. provide a cleaner, linear, bisectable history + * [git prp](doc/git-prp/index.md) - Pull with rebase preserve of merge commits + * [git pruner](doc/git-pruner/index.md) - Prune everything that is unreachable now + * [git publish](doc/git-publish/index.md) - Publish the current branch + * [git pull1](doc/git-pull1/index.md) - Pull just the one current branch + * [git push1](doc/git-push1/index.md) - Push just the one current branch + * [git pushy](doc/git-pushy/index.md) - Push with force and lease + * [git put](doc/git-put/index.md) - Put all changes for the current branch + * [git rb](doc/git-rb/index.md) - Short for "git rebase" + * [git rba](doc/git-rba/index.md) - Rebase abort i.e. abort the rebase process + * [git rbc](doc/git-rbc/index.md) - Rebase continue i.e. continue the rebase process + * [git rbi](doc/git-rbi/index.md) - Rebase interactive i.e. do a rebase with prompts + * [git rbiu](doc/git-rbiu/index.md) - Rebase interactive on unpushed commits + * [git rbs](doc/git-rbs/index.md) - Rebase skip i.e. restart the rebase process by skipping the current patch + * [git rebase-branch](doc/git-rebase-branch/index.md) - Interactively rebase all the commits on the current branch + * [git rebase-recent](doc/git-rebase-recent/index.md) - Rebase recent commits with interactive + * [git ref-recent](doc/git-ref-recent/index.md) - + * [git refs-by-date](doc/git-refs-by-date/index.md) - Show refs sorted by date for branches + * [git reincarnate](doc/git-reincarnate/index.md) - Delete a branch then create it anew + * [git remote-ref](doc/git-remote-ref/index.md) - TODO + * [git remotes-prune](doc/git-remotes-prune/index.md) - For each remote branch, prune it + * [git remotes-push](doc/git-remotes-push/index.md) - For each remote branch, push it + * [git repacker](doc/git-repacker/index.md) - Repack a repo as recommended by Linus + * [git reset-commit](doc/git-reset-commit/index.md) - Reset a commit with a soft reset + * [git reset-commit-hard](doc/git-reset-commit-hard/index.md) - Reset a commit with a hard reset + * [git reset-commit-hard-clean](doc/git-reset-commit-hard-clean/index.md) - Reset a commit with a hard reset and a clean + * [git reset-to-pristine](doc/git-reset-to-pristine/index.md) - Reset commits and clean all differences + * [git reset-to-upstream](doc/git-reset-to-upstream/index.md) - Reset commits back to the upstream branch + * [git rev-list-all-objects-by-size-and-name](doc/git-rev-list-all-objects-by-size-and-name/index.md) - List all objects by size in bytes and file name + * [git rev-list-all-objects-by-size](doc/git-rev-list-all-objects-by-size/index.md) - List all blobs by size in bytes + * [git rl](doc/git-rl/index.md) - Short for "git reflog" + * [git rr](doc/git-rr/index.md) - Short for "git remote" + * [git rrp](doc/git-rrp/index.md) - Remote prune i.e. delete all stale remote-tracking branches under + * [git rrs](doc/git-rrs/index.md) - Remote show i.e. give information about the remote + * [git rru](doc/git-rru/index.md) - remote update i.e. fetch updates for a named set of remotes in the repository as defined by remotes + * [git rv](doc/git-rv/index.md) - Short for "git revert" + * [git rvnc](doc/git-rvnc/index.md) - Revert with no commit i.e. without autocommit + * [git s](doc/git-s/index.md) - Short for "git status" + * [git sb](doc/git-sb/index.md) - Short for "git show-branch" i.e. print a list of branches and their commits + * [git search-commits](doc/git-search-commits/index.md) - Search for a given string in all patches and print commit messages + * [git serve](doc/git-serve/index.md) - Serve the local directory by starting a git server daemon + * [git show-unreachable](doc/git-show-unreachable/index.md) - Show logs of unreachable commits + * [git sm](doc/git-sm/index.md) - Short for "git submodule" + * [git sma](doc/git-sma/index.md) - Submodule add i.e. add a submodule to this repo + * [git smi](doc/git-smi/index.md) - Submodule init i.e. initialize a submodule in this repo + * [git sms](doc/git-sms/index.md) - Submodule sync i.e. synchronize a submodule in this repo + * [git smu](doc/git-smu/index.md) - Submodule update i.e. update a submodule in this repo + * [git smui](doc/git-smui/index.md) - Submodule update with initialize + * [git smuir](doc/git-smuir/index.md) - Submodule update with initialize and recursive; this is useful to bring a submodule fully up to date + * [git snapshot](doc/git-snapshot/index.md) - Take a snapshot of your current working tree + * [git ss](doc/git-ss/index.md) - Status with short format + * [git ssb](doc/git-ssb/index.md) - Status with short format and branch info + * [git stashes](doc/git-stashes/index.md) - List stashes + * [git summary](doc/git-summary/index.md) - Show a summary of some typical metrics + * [git svn-b](doc/git-svn-b/index.md) - Subversion branch + * [git svn-c](doc/git-svn-c/index.md) - Subversion commit + * [git svn-cp](doc/git-svn-cp/index.md) - Subversion cherry pick + * [git svn-m](doc/git-svn-m/index.md) - Subversion merge + * [git tags](doc/git-tags/index.md) - List tags + * [git theirs](doc/git-theirs/index.md) - Checkout their version of a file and add it + * [git top](doc/git-top/index.md) - Get the top level directory name + * [git topic-*](git-topic/index.md) - Read this first about topic aliases + * [git topic-base-branch](doc/git-topic-base-branch/index.md) - Show the project base topic branch name + * [git topic-move](doc/git-topic-move/index.md) - Rename the current topic branch + * [git topic-begin](doc/git-topic-begin/index.md) - Start a new topic branch + * [git topic-end](doc/git-topic-end/index.md) - Finish the current topic branch + * [git topic-sync](doc/git-topic-sync/index.md) - Synchronize the current topic branch by doing updates + * [git track-all-remote-branches](doc/git-track-all-remote-branches/index.md) - Track all remote branches that aren't already being tracked + * [git track](doc/git-track/index.md) - Start tracking a branch, with default parameters, and showing the command + * [git unadd](doc/git-unadd/index.md) - Reset something that's been added + * [git unassume-all](doc/git-unassume-all/index.md) - Unassume all files + * [git unassume](doc/git-unassume/index.md) - Unassume files + * [git uncommit](doc/git-uncommit/index.md) - Reset one commit + * [git undo-commit](doc/git-undo-commit/index.md) - Undo a commit with a soft reset + * [git undo-commit-hard](doc/git-undo-commit-hard/index.md) - Undo a commit with a hard reset + * [git undo-commit-hard-clean](doc/git-undo-commit-hard-clean/index.md) - Undo a commit with a hard reset and a clean + * [git undo-to-pristine](doc/git-undo-to-pristine/index.md) - Undo commits and clean all differences + * [git undo-to-upstream](doc/git-undo-to-upstream/index.md) - Undo commits back to the upstream branch + * [git unpublish](doc/git-unpublish/index.md) - Unpublish the current branch + * [git untrack](doc/git-untrack/index.md) - Stop tracking a branch, with default parameters, and showing the command + * [git unwip](doc/git-unwip/index.md) - Load "work in progress" + * [git upstream-branch](doc/git-upstream-branch/index.md) - Get the upstream branch name + * [git w](doc/git-w/index.md) - Short for "git whatchanged" + * [git whatis](doc/git-whatis/index.md) - Given a git object, try to show it briefly + * [git who](doc/git-who/index.md) - Show a short log of who has contributed commits, in descending order + * [git whois](doc/git-whois/index.md) - Given a string for an author, try to figure out full name and email + * [git wip](doc/git-wip/index.md) - Save "work in progress" + + +### Tracking + + * Package: gitalias + * Version: 27.0.0 + * Created: 2016-06-17T22:05:43Z + * Updated: 2022-01-09T19:00:32Z + * License: GPL-2.0-or-later or contact us for custom license + * Contact: Joel Parker Henderson (joel@joelparkerhenderson.com) diff --git a/doc/alias/TODO/index.md b/doc/alias/TODO/index.md deleted file mode 100644 index f795056f..00000000 --- a/doc/alias/TODO/index.md +++ /dev/null @@ -1,48 +0,0 @@ -# TODO - - # Latest annotated tag in all branches - lasttagged = !git describe --tags `git rev-list --tags --max-count=1` - - # From https://gist.github.com/492227 - heads = !"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';'" - - - ### REF ALIASES ### - - ref-recent = "!git for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) %(objectname:short) %(contents:subject)' refs/heads/" - - ### WORKFLOW ALIASES ### - - # Do everything we can to make the local repo like the main branch. - # - # TODO: handle tags, and delete superfluous branches, and add error handling. - # - mainly = !git checkout main && git fetch origin --prune && git reset --hard origin/main - - -? = !"f() { \ - branch=${1:-$(git config --global init.defaultBranch) - - 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" - - - # Ignore all untracked files by appending them to .gitignore: - ignore = "!git status | grep -P \"^\\t\" | grep -vF .gitignore | sed \"s/^\\t//\" >> .gitignore" - - # Discard changes in a (list of) file(s) in working tree - discard = checkout -- - - - # Thanks to jtolds on stackoverflow - remote-ref = !"sh -c ' \ - 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'" - - # Thanks to jtolds on stackoverflow - rebase-recent = !git rebase --interactive $(git remote-ref) diff --git a/doc/alias/git-a/index.md b/doc/alias/git-a/index.md deleted file mode 100644 index 49833155..00000000 --- a/doc/alias/git-a/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git a - -## Shortcut for "add" - -```gitconfig -a = add -``` - -Example: - -```sh -$ git a file.txt -``` diff --git a/doc/alias/git-aa/index.md b/doc/alias/git-aa/index.md deleted file mode 100644 index 90f516cf..00000000 --- a/doc/alias/git-aa/index.md +++ /dev/null @@ -1,14 +0,0 @@ -# git aa - -## Add all paths - -```gitconfig -aa = add --all -``` - -Example: - -```sh -$ git aa -``` - diff --git a/doc/alias/git-au/index.md b/doc/alias/git-au/index.md deleted file mode 100644 index 23bc1540..00000000 --- a/doc/alias/git-au/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git au - -## Add just the files that are updated - -```gitconfig -au = add --update -``` - -Example: - -```sh -$ git au -``` diff --git a/doc/alias/git-b/index.md b/doc/alias/git-b/index.md deleted file mode 100644 index bb351221..00000000 --- a/doc/alias/git-b/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git b - -## Shortcut for "branch" - -```gitconfig -b = branch -``` - -Example: - -```sh -$ git b -``` diff --git a/doc/alias/git-c/index.md b/doc/alias/git-c/index.md deleted file mode 100644 index f7809edd..00000000 --- a/doc/alias/git-c/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git c - -## Shortcut for "commit" - -```gitconfig -c = commit -``` - -Example: - -```sh -$ git c -``` diff --git a/doc/alias/git-ca/index.md b/doc/alias/git-ca/index.md deleted file mode 100644 index c5412253..00000000 --- a/doc/alias/git-ca/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git ca - -# Amend the tip of the current branch; do not create a new commit - -```gitconfig -ca = commit --amend -``` - -Example: - -```sh -$ git ca -``` diff --git a/doc/alias/git-cam/index.md b/doc/alias/git-cam/index.md deleted file mode 100644 index 2093a9aa..00000000 --- a/doc/alias/git-cam/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git cam - -## Amend the tip of the current branch; edit the message. - -```gitconfig -cam = commit --amend --message -``` - -Example: - -```sh -$ git cam -``` diff --git a/doc/alias/git-cleaner/index.md b/doc/alias/git-cleaner/index.md deleted file mode 100644 index b07ea3a9..00000000 --- a/doc/alias/git-cleaner/index.md +++ /dev/null @@ -1,50 +0,0 @@ -# git cleaner - -## Use git clean to make everything pristine - -```gitconfig -cleaner = clean -ffdx -`` - -Example: - -```sh -$ git cleaner -``` - -This will remove untracked files from the working tree. - -What the flags do: - -
- -
-d
- -
-Normally, when no 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/alias/git-cleanout/index.md b/doc/alias/git-cleanout/index.md deleted file mode 100644 index 08ed5f66..00000000 --- a/doc/alias/git-cleanout/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git cleanout - -## Clean and discard changes and untracked files in working tree - -```gitconfig -cleanout = !git clean -df && git checkout -- . -``` - -Example: - -```sh -$ git cleanout -``` diff --git a/doc/alias/git-cloner/index.md b/doc/alias/git-cloner/index.md deleted file mode 100644 index 4507e0a0..00000000 --- a/doc/alias/git-cloner/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git cloner - -## Clone a repository and recurse on any of its submodules - -```gitconfig -cloner = clone --recurse-submodules -``` - -Example: - -```sh -$ git cloner -``` diff --git a/doc/alias/git-cull-locals/index.md b/doc/alias/git-cull-locals/index.md deleted file mode 100644 index 48d21e4e..00000000 --- a/doc/alias/git-cull-locals/index.md +++ /dev/null @@ -1,35 +0,0 @@ -# git cull-locals - -## Delete local branches that have been merged - -```gitconfig -cull-locals = !"f() { \ - commit=${1:-$(git current-branch)}; \ - git branch --merged \"$commit" | \ - xargs git branch --delete -}; f \"$@\"" -``` - -Syntax: - -```sh -cull-locals [] -``` - -Example that uses the default i.e. current branch name: - -```sh -$ git cull-locals -``` - -Example with a specific branch name: - -```sh -$ git cull-locals main -``` - -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 [git cull-remotes](../git-cull-remotes). diff --git a/doc/alias/git-cull-remotes/index.md b/doc/alias/git-cull-remotes/index.md deleted file mode 100644 index 03ae0fed..00000000 --- a/doc/alias/git-cull-remotes/index.md +++ /dev/null @@ -1,44 +0,0 @@ -# git cull-remotes - -## Delete remote branches that have been merged into the upstream commit - -```gitconfig -cull-remotes = !"f() { \ - commit=${1:-$(git upstream-branch-name)}; \ - git branch --remotes --merged "$commit" | \ - grep -v "^[[:space:]]*$upstream_name$" \ - sed 's#[[:space:]]*origin/##' | \ - xargs -I% git push origin :% 2>&1 ; \ -}; f \"$@\"" -``` - -Example: - -```sh -$ git cull-remotes -``` - - -Syntax: - -```sh -git cull-remotes [] -``` - -Example that uses the default i.e. upstream branch name: - -```sh -git cull-remotes main -``` - -Example that uses a specific branch name: - -```sh -git cull-remotes main -``` - -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 [git cull-locals](../git-cull-locals). diff --git a/doc/alias/git-d/index.md b/doc/alias/git-d/index.md deleted file mode 100644 index 982b9e93..00000000 --- a/doc/alias/git-d/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git d - -## Shortcut for "diff" - -```gitalias -d = diff -``` - -Example: - -```sh -$ git d -``` diff --git a/doc/alias/git-default-branch/index.md b/doc/alias/git-default-branch/index.md deleted file mode 100644 index 5a292920..00000000 --- a/doc/alias/git-default-branch/index.md +++ /dev/null @@ -1,14 +0,0 @@ -# git default-branch - -## Get the default branch name - -```gitconfig -default-branch = config init.defaultBranch -``` - -Example: - -```sh -$ git default-branch -main -``` diff --git a/doc/alias/git-f/index.md b/doc/alias/git-f/index.md deleted file mode 100644 index 860d092a..00000000 --- a/doc/alias/git-f/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git f - -## Shortcut for "fetch" - -```gitconfig -f = fetch -``` - -Example: - -```sh -$ git f -``` diff --git a/doc/alias/git-initer/index.md b/doc/alias/git-initer/index.md deleted file mode 100644 index 72e5a4d7..00000000 --- a/doc/alias/git-initer/index.md +++ /dev/null @@ -1,18 +0,0 @@ -# git initer - -# Initalize a repo with an empty commit to help rebase - -```gitconfig -initer = !"f() { \ - git init && \ - git commit --allow-empty --allow-empty-message --message ''; \ -}; f" -``` - -Example: - -```sh -$ git initer -``` - -This tactic makes it easier to do subsequent git rebase commands. diff --git a/doc/alias/git-l/index.md b/doc/alias/git-l/index.md deleted file mode 100644 index f6aa4b68..00000000 --- a/doc/alias/git-l/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git l - -## Shortcut for "log" - -```gitalias -l = log -``` - -Example: - -```sh -$ git l -``` diff --git a/doc/alias/git-last-tag/index.md b/doc/alias/git-last-tag/index.md deleted file mode 100644 index d4e911bf..00000000 --- a/doc/alias/git-last-tag/index.md +++ /dev/null @@ -1,37 +0,0 @@ -# git last-tag - -## Show the last tag in the current branch - -```gitconfig -last-tag = describe --tags --abbrev=0 -``` - -Example: - -```sh -$ 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=
- -
-Instead of using the default 7 hexadecimal digits as the -abbreviated object name, use digits, or as many digits -as needed to form a unique object name. An of 0 will -suppress long format, only showing the closest tag. -
- -
diff --git a/doc/alias/git-ll/index.md b/doc/alias/git-ll/index.md deleted file mode 100644 index 732804e9..00000000 --- a/doc/alias/git-ll/index.md +++ /dev/null @@ -1,31 +0,0 @@ -# git ll - -## Log love - our preferred way key performance indicators. - -```gitconfig -ll = log \ - --graph \ - --topo-order \ - --decorate \ - --all \ - --boundary \ - --date=short \ - --abbrev-commit \ - --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' -``` - -Example: - -```sh -$ git ll -* 2021-01-01 a1b2c3d - Add feature foo [Alice Adams] N -… -``` - -This alias `git ll` is the same as [git lll](../git-lll) except: - - * Short date format using YYYY-MM-DD (no time, no zone) - - * Short commit format using abbreviated hexadecimal (not full hexadecimal) - - * Short author field using name (no email address) diff --git a/doc/alias/git-log/index.md b/doc/alias/git-log/index.md deleted file mode 100644 index b8630762..00000000 --- a/doc/alias/git-log/index.md +++ /dev/null @@ -1,157 +0,0 @@ -# git log - -## Log helpers - -```gitconfig -# Show log of changes, most recent first -log-changes = log --oneline --reverse - -# Show log of new commits after you fetched, with stats, excluding merges -log-fresh = log ORIG_HEAD.. --stat --no-merges - -# Show log in our preferred format for our key performance indicators. A.k.a. `ll`. -log-like = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' - -# Show log in our preferred format for our key performance indicators, with long items. A.k.a. `lll`. -log-like-long = log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%Creset %Cblue%G?%Creset' - -# Show log with dates in our local timezone -log-local = log --date=local - -# Show the log for my own commits by my own user email -log-my = !git log --author $(git config user.email) - -# Show log as a graph -log-graph = log --graph --all --oneline --decorate - -# Show the date of the earliest commit, in strict ISO 8601 format -log-first-date = !"git log --date-order --format=%cI | tail -1" - -# Show the date of the latest commit, in strict ISO 8601 format -log-latest-date = log -1 --date-order --format=%cI - -# Show the log of the recent hour, day, week, month, year -log-hour = log --since=1-hour-ago -log-day = log --since=1-day-ago -log-week = log --since=1-week-ago -log-month = log --since=1-month-ago -log-year = log --since=1-year-ago - -# Show the log of my own recent hour, day, week, month, year -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 - -# Show a specific format string and its number of log entries -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" - -# Show the number of log entries by a specific format string and date format string -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" - -# Show the number of log items by email -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" - -# Show the number of log items by hour -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" - -# Show the number of log items by day -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" - -# Show the number of log items by week -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" - -# Show the number of log items by month -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" - -# Show the number of log items by year -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" - -# Show the number of log items by hour of day -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" - -# Show the number of log items by day of week -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" - -# Show the number of log items by week of year -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" - -# 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: - -```sh -$ git log-changes -$ git log-fresh -$ git log-like -$ git log-like-long -$ git log-local -$ git log-my -$ git log-graph -$ git log-first-date -$ git log-latest-date = log -1 --date-order --format=%cI - -$ git log-hour -$ git log-day -$ git log-week -$ git log-month -$ git log-year - -$ git log-my-hour -$ git log-my-day -$ git log-my-week -$ git log-my-month -$ git log-my-year - -$ git log-of-format-and-count -$ git log-of-format-and-count-with-date - -$ git log-of-email-and-count -$ git log-of-count-and-email - -$ git log-of-hour-and-count -$ git log-of-count-and-hour - -$ git log-of-day-and-count -$ git log-of-count-and-day - -$ git log-of-week-and-count -$ git log-of-count-and-week - -$ git log-of-month-and-count -$ git log-of-count-and-month - -$ git log-of-year-and-count -$ git log-of-count-and-year - -$ git log-of-hour-of-day-and-count -$ git log-of-count-and-hour-of-day - -$ git log-of-day-of-week-and-count -$ git log-of-count-and-day-of-week - -$ git log-of-week-of-year-and-count -$ git log-of-count-and-week-of-year - -$ git log-refs -$ git log-timeline -$ git log-local -$ git log-fetched -``` diff --git a/doc/alias/git-m/index.md b/doc/alias/git-m/index.md deleted file mode 100644 index 219e3b80..00000000 --- a/doc/alias/git-m/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git m - -## Shortcut for "merge" - -```gitconfig -m = merge -``` - -Example: - -```sh -$ git m -``` diff --git a/doc/alias/git-o/index.md b/doc/alias/git-o/index.md deleted file mode 100644 index 4075d55f..00000000 --- a/doc/alias/git-o/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git o - -## Shortcut for "checkout" - -```gitalias -o = checkout -``` - -Example: - -```sh -$ git o -``` diff --git a/doc/alias/git-p/index.md b/doc/alias/git-p/index.md deleted file mode 100644 index 0d821244..00000000 --- a/doc/alias/git-p/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git p - -## Shortcut for "pull" - -```gitalias -p = pull -``` - -Example: - -```sh -$ git p -``` diff --git a/doc/alias/git-publish-git-unpublish/index.md b/doc/alias/git-publish-git-unpublish/index.md deleted file mode 100644 index 67657d54..00000000 --- a/doc/alias/git-publish-git-unpublish/index.md +++ /dev/null @@ -1,21 +0,0 @@ -# git publish & git unpublish - -## Publish/unpublish the current branch - -```gitconfig -# git publish: publish the current branch by pushing it -# to the remote "origin", and setting the current branch -# to track the upstream branch. -publish = !"git push --set-upstream origin $(git current-branch)" - -# git unpublish: unpublish the current branch by deleting the -# remote version of the current branch. -unpublish = !"git push origin :$(git current-branch)" -``` - -Example: - -```sh -$ git publish -$ git unpublish -``` diff --git a/doc/alias/git-r/index.md b/doc/alias/git-r/index.md deleted file mode 100644 index 54c68926..00000000 --- a/doc/alias/git-r/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git r - -## Shortcut for "remote" - -```gitconfig -r = remote -``` - -Example: - -```sh -$ git r -``` diff --git a/doc/alias/git-rb/index.md b/doc/alias/git-rb/index.md deleted file mode 100644 index 01597527..00000000 --- a/doc/alias/git-rb/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git rb - -## Shortcut for "rebase" - -```gitconfig -rb = rebase -``` - -Example: - -```sh -$ git rb -``` diff --git a/doc/alias/git-rr/index.md b/doc/alias/git-rr/index.md deleted file mode 100644 index 139c66e1..00000000 --- a/doc/alias/git-rr/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git rr - -## Shortcut for "remote" - -```gitconfig -rr = remote -``` - -Example: - -```sh -$ git rr -``` diff --git a/doc/alias/git-rvnc/index.md b/doc/alias/git-rvnc/index.md deleted file mode 100644 index cc917b1e..00000000 --- a/doc/alias/git-rvnc/index.md +++ /dev/null @@ -1,16 +0,0 @@ -# git rvnc - -## revert with no commit i.e. without autocommit - -```gitconfig -rvnc = revert --no-commit -``` - -Example: - -```sh -$ 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/alias/git-s/index.md b/doc/alias/git-s/index.md deleted file mode 100644 index 062a4146..00000000 --- a/doc/alias/git-s/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git s - -## Shortcut for "status" - -```gitconfig -s = status -``` - -Example: - -```sh -$ git s -``` diff --git a/doc/alias/git-sb/index.md b/doc/alias/git-sb/index.md deleted file mode 100644 index 729d116f..00000000 --- a/doc/alias/git-sb/index.md +++ /dev/null @@ -1,13 +0,0 @@ -# git sb - -## Shortcut for "show-branch" i.e. print a list of branches and their commits - -```gitconfig -sb = show-branch -``` - -Example: - -```sh -$ git sb -``` diff --git a/doc/alias/git-upstream-branch/index.md b/doc/alias/git-upstream-branch/index.md deleted file mode 100644 index 05fbfef5..00000000 --- a/doc/alias/git-upstream-branch/index.md +++ /dev/null @@ -1,14 +0,0 @@ -# git upstream-branch - -## Get the upstream branch name - -```gitconfig -upstream-branch = !git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD) -``` - -Example: - -```sh -$ git upstream-branch -origin/main -``` diff --git a/doc/alias/index.md b/doc/alias/index.md deleted file mode 100644 index e2ded30a..00000000 --- a/doc/alias/index.md +++ /dev/null @@ -1,350 +0,0 @@ -# Git Alias - -This project provides many git alias commands that you can use as you like. - -* [Introduction](introduction.md) -* [Install](install.md) -* [Examples](examples.md) -* [Customize](customize.md) - - -## One letter aliases - -One letter aliases are for our most-frequent commands: - -* [git a](git-a.md) = add -* [git b](git-b.md) = branch -* [git c](git-c.md) = commit -* [git d](git-d.md) = diff -* [git f](git-f.md) = fetch -* [git g](git-g.md) = grep -* [git l](git-l.md) = log -* [git m](git-m.md) = merge -* [git o](git-o.md) = checkout -* [git p](git-p.md) = pull -* [git s](git-s.md) = status -* [git w](git-w.md) = whatchanged - -One-letter aliases never use options, because we want -the aliases to be easy to compose and to be flexible. - - -## Short aliases for frequent commands - -Short aliases are for our very-frequent commands: - -git add: - -* [git a](git-a.md) = add -* [git aa](git-aa.md) = add --all -* [git ap](git-ap.md) = add --patch -* [git au](git-au.md) = add --update - -git branch: - -* [git b](git-bm.md) = branch -* [git bm](git-bm.md) = branch --merged -* [git bnm](git-bm.md) = branch --no-merged -* [git bed](git-bed.md) = branch --edit-description -* [git bsd](git-bsd.md) = branch --show-description (wishlist) - -git commit: - -* [git c](git-ca.md) = commit -* [git ca](git-ca.md) = commit --amend -* [git cam](git-cam.md) = commit --amend --message -* [git cane](git-cane.md) = commit --amend --no-edit -* [git ci](git-ci.md) = commit --interactive -* [git cm](git-ci.md) = commit --message - -git checkout: - -* [git co](git-co.md) = checkout -* [git cog](git-cog.md) = checkout --guess -* [git cong](git-cong.md) = checkout --no-guess - -git cherry-pick: - -* [git cp](git-cp.md) = cherry-pick -* [git cpa](git-cpa.md) = cherry-pick --abort -* [git cpc](git-cpc.md) = cherry-pick --continue -* [git cpn](git-cpn.md) = cherry-pick -n (--no-commit) -* [git cpnx](git-cpnx.md) = cherry-pick -n -x (--no-commit and with a message) - -git diff: - -* [git d](git-d.md) = diff -* [git dd](git-dd.md) = diff with our preferred settings -* [git dc](git-dc.md) = diff --cached -* [git ds](git-ds.md) = diff --staged -* [git dwd](git-ds.md) = diff --word-diff - -git grep: - -* [git g](git-g.md) = grep -* [git gg](git-gg.md) = grep with our preferred settings -* [git gn](git-gn.md) = grep -n (--line-number) - -git log: - -* [git l](git-l.md) = log -* [git ll](git-ll.md) = log with our preferred short settings -* [git lll](git-lll.md) = log with our preferred long settings -* [git lg](git-lg.md) = log --graph -* [git lo](git-lo.md) = log --oneline -* [git lp](git-lp.md) = log --patch -* [git lfp](git-lfp.md) = log --first-parent -* [git lto](git-lto.md) = log --topo-order - -git ls-files: - -* [git ls](git-ls.md) = ls-files -* [git lsd](git-lsd.md) = ls-files --debug -* [git lsfn](git-lsfn.md) = ls-files --full-name -* [git lsio](git-lsio.md) = ls-files --ignored --others --exclude-standard - -git merge: - -* [git m](git-m.md) = merge -* [git ma](git-ma.md) = merge --abort -* [git mc](git-mc.md) = merge --continue -* [git me](git-me.md) = merge --no-commit --no-ff - -git pull: - -* [git pf](git-pf.md) - git pull with fast-forward only -* [git pr](git-pr.md) - git pull with rebase -* [git pp](git-pp.md) - git pull with rebase preserve of merge commits - -git rebase: - -* [git rb](git-rb.md) = rebase -* [git rba](git-rb.md) = rebase --abort -* [git rbc](git-rbc.md) = rebase --continue -* [git rbs](git-rbs.md) = rebase --skip -* [git rbi](git-rbi.md) = rebase --interactive -* [git rbiu](git-rbiu.md) = rebase --interactive @{upstream} - -git reflog: - -* [git rl](git-rl.md) = reflog - -git remote: - -* [git rr](git-rr.md) = remote -* [git rrs](git-rrs.md) = remote show -* [git rru](git-rru.md) = remote update -* [git rrp](git-rrp.md) = remote prune - -git revert: - -* [git rv](git-rv.md) = revert -* [git rvnc](git-rvnc.md) = revert --no-commit - -git show-branch: - -* [git sb](git-sb.md) = show-branch -* [git sbdo](git-sbdo.md) = show-branch --date-order -* [git sbto](git-sbto.md) = show-branch --topo-order - -git submodule: - -* [git sm](git-sm.md) = submodule -* [git smi](git-smi.md) = submodule init -* [git sma](git-sma.md) = submodule add -* [git sms](git-sms.md) = submodule sync -* [git smu](git-smu.md) = submodule update -* [git smui](git-smui.md) = submodule update --init -* [git smuir](git-smuir.md) = submodule update --init --recursive - -git status: - -* [git s](git-s.md) = status -* [git ss](git-ss.md) = status --short -* [git ssb](git-ssb.md) = status --short --branch - - -## Friendly aliases - -Start: - -* [git initer](git-initer.md) - Initialize a repo with an empty rebaseable commit. -* [git cloner](git-cloner.md) - Clone a repo and recurse on any of its submodules. - -Branch names: - -* [git default-branch](git-default-branch.md) - Get the default branch name. -* [git current-branch](git-current-branch.md) - Get the current branch name. -* [git upstream-branch](git-upstream-branch.md) - Get the upstream branch name. -* [git topic-branch](git-topic-branch.md) - Get the topic branch name. - -List items: - -* [git aliases](git-aliases.md) - List aliases. -* [git branches](git-branches.md) - List branches. -* [git tags](git-tags.md) - List tags. -* [git stashes](git-stashes.md) - List stashes. - -Undo: - -* [git uncommit](git-uncommit.md) = reset --soft HEAD~1 -* [git unadd](git-unadd.md) = reset HEAD - - -## Convenience alaises - -Logging & reporting: - -* [git log](git-log.md) -* [git who](git-who.md) -* [git chart](git-chart.md) -* [git churn](git-churn.md) -* [git summary](git-summary.md) - -Lookups: - -* [git whois](git-whois.md) - Try to figure out an author's information. -* [git whatis](git-whatis.md) - Try to figure out an object's information. - -Commit details: - -* [git commit-parents](git-commit-parents.md) - Show the commit's parents. -* [git commit-is-merge](git-commit-is-merge.md) - Is the commit a merge commit? -* [git commit-message-key-lines](git-commit-message-key-lines.md) - -Add all & edit all: - -* [git add-*](git-edit.md) - Add all files of a given type. -* [git edit-*](git-edit.md) - Edit all files of a given type. - -Alias helpers: - -* [git add-alias](git-add-alias.md) - Create a new git alias. -* [git move-alias](git-move-alias.md) - Rename an existing git alias. - -Script helpers: - -* [git top-name](git-top-name.md) - Get the top level directory name. -* [git exec](git-exec.md) - Execute a shell script. - -Remotes: - -* [git remotes-prune](git-remotes-prune.md) - For each remote branch, prune it. -* [git remotes-push](git-remotes-push.md) - For each remote branch, push it. - -Misc: - -* [git diff-*](git-diff.md) -* [git grep-*](git-grep.md) -* [git merge-span-*](git-merge-span.md) -* [git orphans](git-orphans.md) -* [git fixup](git-fixup.md) -* [git rev-list-all-objects-by-size](git-rev-list-all-objects-by-size.md) -* [git rev-list-all-objects-by-size-and-name](git-rev-list-all-objects-by-size-and-name.md) -* [git cherry-pick-merge](git-cherry-pick-merge.md) -* [git refs-by-date](git-refs-by-date.md) - Sort by date for branches. - -Advanced aliases: - -* [git search-commits](git-search-commits.md) -* [git debug](git-debug.md) -* [git intercommit](git-intercommit.md) - - -## Workflow aliases - -Starting: - -* [git clone-lean](git-clone-lean.md) - -Save: - -* [git archive](git-archive.md) - Create an archive file of everything in the repo. -* [git snapshot](git-snapshot.md) - Stash a snapshot of your current working tree. -* [git panic](git-panic.md) - When you're worried the world is coming to an end. - -Flow aliases: - -* [git get & git put](git-get-git-put.md) -* [git ours & git theirs](git-ours-git-theirs.md) -* [git wip & git unwip](git-wip-git-unwip.md) -* [git assume & git unassume](git-assume-git-unassume.md) -* [git publish & git unpublish](git-publish-git-unpublish.md) - -reset & undo: - -* [git reset-*](git-reset.md) - Move backwards on the commit chain. -* [git undo-*](git-undo.md) - Move backwards on the commit chain. - -track & untrack: - -* [git track](git-track.md) - Start tracking from a local branch to upstream branch. -* [git untrack](git-untrack.md) - Stop tracking from a local branch to upstream branch. - -inbound & outbound: - -* [git inbound](git-inbound.md) - Show incoming changes compared to upstream. -* [git outbound](git-outbound.md) - Show outgoing changes compared to upstream. - -pull1 & push1: - -* [git pull1](git-pull1.md) - Pull just the current branch. -* [git push1](git-push1.md) - Push just the current branch. - -Topic branches: - -* [git topic-*](git-topic.md) - Read this first about topic branches. -* [git topic-branch](git-topic-branch.md) - Show the topic branch name. -* [git topic-start](git-topic-start.md) - Begin a topic branch. -* [git topic-stop](git-topic-stop.md) - End a topic branch. -* [git topic-sync](git-topic-sync.md) - Update a topic branch. -* [git topic-move](git-topic-move.md) - Rename a topic branch. - -Cull: - -* [git cull](git-cull-local.md) - Delete all branches that are merged. -* [git cull-locals](git-cull-local.md) - Delete local branches that are merged. -* [git cull-remotes](git-cull-remote.md) - Delete remote branches that are merged. - -Maintenance tuning: - -* [git cleaner](git-cleaner.md) - Clean the recommend way. -* [git pruner](git-pruner.md) - Prune the recommened way. -* [git repacker](git-repacker.md) - Repack the recommended way. -* [git optimizer](git-optimizer.md) - Optimize the recommended way. - -Misc: - -* [git issues](git-issues.md) - Show issues that are described in commit messages. -* [git expunge](git-expunge.md) - Use filter-branch to delete a file everywhere. -* [git reincarnate](git-reincarnate.md) - Kill a branch then create it anew. -* [git diff-chunk](git-diff-chunk.md) - Do a diff of two chunks in revisions. -* [git last-tag](git-last-tag.md) - Show the last tag in the current branch. -* [git serve](git-serve.md) - Serve the local directory via git server daemon. -* [git track-all-remote-branches](git-track-all-remote-branches.md) - Track all remote branches. -# [git cleanout](git-cleanout.md) - Clean and discard changes and untracked files in working tree. - - -## Tooling aliases - -Use gitk: - -* [git gitk-conflict](git-gitk-conflict.md) - Use gitk to show conflicting merge. -* [git gitk-history-all](git-history-all.md) - Use gitk to show full history. - -Use other version control systems: - -* [git cvs-*](git-cvs.md) - Use CVS version control. -* [git svn-*](git-svn.md) - Use Subversion version control. - -Use graphviz: - -* [git graphviz](git-graphviz.md) - Use graphviz for display. - - -## Epilog - -* [More information](more.html) -* [Contributing](contributing.md) -* [To do list](todo.html) -* [Thanks](thanks.html) diff --git a/doc/assets/prism.css b/doc/assets/prism.css new file mode 100644 index 00000000..15f30faf --- /dev/null +++ b/doc/assets/prism.css @@ -0,0 +1,3 @@ +/* PrismJS 1.25.0 +https://prismjs.com/download.html#themes=prism&languages=bash+git */ +code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#9a6e3a;background:hsla(0,0%,100%,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help} diff --git a/doc/assets/prism.js b/doc/assets/prism.js new file mode 100644 index 00000000..b9fd1e97 --- /dev/null +++ b/doc/assets/prism.js @@ -0,0 +1,5 @@ +/* PrismJS 1.25.0 +https://prismjs.com/download.html#themes=prism&languages=bash+git */ +var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,e={},M={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof W?new W(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/=l.reach);y+=m.value.length,m=m.next){var k=m.value;if(t.length>n.length)return;if(!(k instanceof W)){var x,b=1;if(h){if(!(x=z(p,y,n,f))||x.index>=n.length)break;var w=x.index,A=x.index+x[0].length,P=y;for(P+=m.value.length;P<=w;)m=m.next,P+=m.value.length;if(P-=m.value.length,y=P,m.value instanceof W)continue;for(var E=m;E!==t.tail&&(Pl.reach&&(l.reach=j);var C=m.prev;S&&(C=I(t,C,S),y+=S.length),q(t,C,b);var N=new W(o,g?M.tokenize(L,g):L,d,L);if(m=I(t,C,N),O&&I(t,m,O),1l.reach&&(l.reach=_.reach)}}}}}}(e,a,n,a.head,0),function(e){var n=[],t=e.head.next;for(;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=M.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=M.hooks.all[e];if(t&&t.length)for(var r,a=0;r=t[a++];)r(n)}},Token:W};function W(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||"").length}function z(e,n,t,r){e.lastIndex=n;var a=e.exec(t);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function i(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function I(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function q(e,n,t){for(var r=n.next,a=0;a"+a.content+""},!u.document)return u.addEventListener&&(M.disableWorkerMessageHandler||u.addEventListener("message",function(e){var n=JSON.parse(e.data),t=n.language,r=n.code,a=n.immediateClose;u.postMessage(M.highlight(r,M.languages[t],t)),a&&u.close()},!1)),M;var r=M.util.currentScript();function a(){M.manual||M.highlightAll()}if(r&&(M.filename=r.src,r.hasAttribute("data-manual")&&(M.manual=!0)),!M.manual){var l=document.readyState;"loading"===l||"interactive"===l&&r&&r.defer?document.addEventListener("DOMContentLoaded",a):window.requestAnimationFrame?window.requestAnimationFrame(a):window.setTimeout(a,16)}return M}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); +!function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=a.variable[1].inside,i=0;i \"; \ @@ -23,8 +25,8 @@ add-alias = "!f() { \ Example: -```sh -$ git add-alias --local myalias mycommand +```shell +git add-alias --local myalias mycommand -$ git add-alias --global myalias mycommand +git add-alias --global myalias mycommand ``` diff --git a/doc/git-add-cached/index.md b/doc/git-add-cached/index.md new file mode 100644 index 00000000..767bdae2 --- /dev/null +++ b/doc/git-add-cached/index.md @@ -0,0 +1,37 @@ +# git add-cached + +## Add cached files + +Git alias: + +```git +add-cached = !"f() { git ls-files --cached | sort -u ; }; git add `f`" +``` + +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/index.md b/doc/git-add-deleted/index.md new file mode 100644 index 00000000..38eb3f49 --- /dev/null +++ b/doc/git-add-deleted/index.md @@ -0,0 +1,37 @@ +# git add-deleted + +## Add deleted files + +Git alias: + +```git +add-deleted = !"f() { git ls-files --deleted | sort -u ; }; git add `f`" +``` + +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/index.md b/doc/git-add-ignored/index.md new file mode 100644 index 00000000..a3cb0d27 --- /dev/null +++ b/doc/git-add-ignored/index.md @@ -0,0 +1,37 @@ +# git add-ignored + +## Add ignored files + +Git alias: + +```git +add-ignored = !"f() { git ls-files --ignored | sort -u ; }; git add `f`" +``` + +Example: + +```shell +git add-ignored +``` + +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) (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 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-killed/index.md b/doc/git-add-killed/index.md new file mode 100644 index 00000000..55c5ec7c --- /dev/null +++ b/doc/git-add-killed/index.md @@ -0,0 +1,37 @@ +# git add-killed + +## Add killed files + +Git alias: + +```git +add-killed = !"f() { git ls-files --killed | sort -u ; }; git add `f`" +``` + +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/index.md b/doc/git-add-modified/index.md new file mode 100644 index 00000000..12014f37 --- /dev/null +++ b/doc/git-add-modified/index.md @@ -0,0 +1,37 @@ +# git add-modified + +## Add modified files + +Git alias: + +```git +add-modified = !"f() { git ls-files --modified | sort -u ; }; git add `f`" +``` + +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/index.md b/doc/git-add-others/index.md new file mode 100644 index 00000000..b1c62154 --- /dev/null +++ b/doc/git-add-others/index.md @@ -0,0 +1,37 @@ +# git add-others + +## Add other files + +Git alias: + +```git +add-others = !"f() { git ls-files --others | sort -u ; }; git add `f`" +``` + +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/index.md b/doc/git-add-stage/index.md new file mode 100644 index 00000000..e32aec5d --- /dev/null +++ b/doc/git-add-stage/index.md @@ -0,0 +1,37 @@ +# git add-stage + +## Add stage files + +Git alias: + +```git +add-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; git add `f`" +``` + +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/index.md b/doc/git-add-unmerged/index.md new file mode 100644 index 00000000..7b8dd470 --- /dev/null +++ b/doc/git-add-unmerged/index.md @@ -0,0 +1,37 @@ +# git add-unmerged + +## Add unmerged files + +Git alias: + +```git +add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`" +``` + +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/alias/git-add/index.md b/doc/git-add/index.md similarity index 67% rename from doc/alias/git-add/index.md rename to doc/git-add/index.md index 0b222f01..f3cec69c 100644 --- a/doc/alias/git-add/index.md +++ b/doc/git-add/index.md @@ -1,8 +1,21 @@ -# git add-* +# git add -## Add all paths of the given type +## Aliases to add files -```gitconfig + +### 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`" @@ -15,15 +28,15 @@ add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add Example: -```sh -$ git add-cached -$ git add-deleted -$ git add-others -$ git add-ignored -$ git add-killed -$ git add-modified -$ git add-stage -$ git add-unmerged +```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/alias/git-aliases/index.md b/doc/git-aliases/index.md similarity index 83% rename from doc/alias/git-aliases/index.md rename to doc/git-aliases/index.md index 7f0f55ce..d8d1b630 100644 --- a/doc/alias/git-aliases/index.md +++ b/doc/git-aliases/index.md @@ -2,19 +2,21 @@ ## List git aliases -```gitconfig +Git alias: + +```git aliases = "!git config --get-regexp '^alias\\.' | cut -c 7- | sed 's/ / = /'" ``` Example: -```sh -$ git aliases +```shell +git aliases ``` This alias is because friendly wording is easier to remember. -Our friendly wording for plurals: +Our friendly wording for plurals: * [git aliases](../git-aliases) diff --git a/doc/alias/git-ap/index.md b/doc/git-ap/index.md similarity index 57% rename from doc/alias/git-ap/index.md rename to doc/git-ap/index.md index 72e28a5a..364aacdc 100644 --- a/doc/alias/git-ap/index.md +++ b/doc/git-ap/index.md @@ -1,15 +1,17 @@ # git ap -## Add by patch +## Short for "git add --patch" - Add by patch -```gitconfig +Git alias: + +```git ap = add --patch ``` Example: -```sh -$ git ap +```shell +git ap ``` Show each change, and ask if we want to add it in the repo. diff --git a/doc/alias/git-archive/index.md b/doc/git-archive/index.md similarity index 88% rename from doc/alias/git-archive/index.md rename to doc/git-archive/index.md index e335226c..c01a1847 100644 --- a/doc/alias/git-archive/index.md +++ b/doc/git-archive/index.md @@ -2,7 +2,9 @@ ## Create an archive file of everything in the repo -```gitconfig +Git alias: + +```git archive = !"f() { \ top=$(rev-parse --show-toplevel); \ cd $top; \ @@ -12,8 +14,8 @@ archive = !"f() { \ Example: -```sh -$ git archive +```shell +git archive ``` This archive can be useful for backups, disaster recovery, diff --git a/doc/git-assume-all/index.md b/doc/git-assume-all/index.md new file mode 100644 index 00000000..04eba132 --- /dev/null +++ b/doc/git-assume-all/index.md @@ -0,0 +1,17 @@ +# git assume-all + +## Assume all files are unchanged + +Git alias: + +```git +assume-all = "!git st -s | awk {'print $2'} | xargs git assume" +``` + +Example: + +```shell +git assume-all +``` + +To see how this works, see [git assume-* & git unassume-*](../git-assume-and-git-unassume) diff --git a/doc/alias/git-assume-git-unassume/index.md b/doc/git-assume-and-git-unassume/index.md similarity index 84% rename from doc/alias/git-assume-git-unassume/index.md rename to doc/git-assume-and-git-unassume/index.md index 4b51aa0d..7be315af 100644 --- a/doc/alias/git-assume-git-unassume/index.md +++ b/doc/git-assume-and-git-unassume/index.md @@ -1,8 +1,10 @@ -# git assume-* & git unassume +# git assume-* & git unassume-* ## Use update-index and assume-unchanged to skip commits -```gitconfig +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-" @@ -20,25 +22,25 @@ 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" +Suppose we want to edit the file "passwords.txt" and also be sure that we never check it in. Example: -```sh -$ git status +```shell +git status modified passwords.txt modified foo.txt -$ git assume passwords.txt -$ git status +git assume passwords.txt +git status modified foo.txt -$ git assumed +git assumed passwords.txt -$ git unassume passwords.txt -$ git status +git unassume passwords.txt +git status modified passwords.txt modified foo.txt ``` diff --git a/doc/git-assume/index.md b/doc/git-assume/index.md new file mode 100644 index 00000000..9631a424 --- /dev/null +++ b/doc/git-assume/index.md @@ -0,0 +1,17 @@ +# git assume + +## Assume files are unchanged + +Git alias: + +```git +assume = update-index --assume-unchanged +``` + +Example: + +```shell +git assume +``` + +To see how this works, see [git assume-* & git unassume-*](../git-assume-and-git-unassume) diff --git a/doc/git-assumed/index.md b/doc/git-assumed/index.md new file mode 100644 index 00000000..6436e759 --- /dev/null +++ b/doc/git-assumed/index.md @@ -0,0 +1,17 @@ +# git assumed + +## Show which files are assumed + +Git alias: + +```git +assumed = !"git ls-files -v | grep ^h | cut -c 3-" +``` + +Example: + +```shell +git assumed +``` + +To see how this works, see [git assume-* & git unassume-*](../git-assume-and-git-unassume) diff --git a/doc/git-au/index.html b/doc/git-au/index.html new file mode 100644 index 00000000..0c4561ea --- /dev/null +++ b/doc/git-au/index.html @@ -0,0 +1,55 @@ + + + + + + git au - GitAlias + + + + + + + + +
+

git au

+

Short for “add –update”

+

Add just the files that are updated.

+

Git alias:

+
au = add --update
+
+

Example:

+
$ 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/index.md b/doc/git-au/index.md new file mode 100644 index 00000000..07be4fdc --- /dev/null +++ b/doc/git-au/index.md @@ -0,0 +1,35 @@ +# git au + +## Short for "git add --update" + +Add just the files that are updated. + +Git alias: + +```git +au = add --update +``` + +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-b/index.md b/doc/git-b/index.md new file mode 100644 index 00000000..517c16a3 --- /dev/null +++ b/doc/git-b/index.md @@ -0,0 +1,15 @@ +# git b + +## Short for "git branch" + +Git alias: + +```git +b = branch +``` + +Example: + +```shell +git b +``` diff --git a/doc/alias/git-bed/index.md b/doc/git-bed/index.md similarity index 82% rename from doc/alias/git-bed/index.md rename to doc/git-bed/index.md index a911394e..91349997 100644 --- a/doc/alias/git-bed/index.md +++ b/doc/git-bed/index.md @@ -2,14 +2,16 @@ ## Edit the description of a branch -```gitconfig +Git alias: + +```git bed = branch --edit-description ``` Example: -```sh -$ git bed +```shell +git bed ``` Compare [git bsd](../git-bsd) in order to show the branch description. diff --git a/doc/alias/git-bm/index.md b/doc/git-bm/index.md similarity index 68% rename from doc/alias/git-bm/index.md rename to doc/git-bm/index.md index cfe269ec..2112f6d2 100644 --- a/doc/alias/git-bm/index.md +++ b/doc/git-bm/index.md @@ -1,7 +1,9 @@ # git bm -## List branches whose tips are reachable from the specified commit (HEAD if not specified). +## List branches whose tips are reachable from the specified commit (HEAD if not specified) -```gitconfig +Git alias: + +```git bm = branch --merged ``` diff --git a/doc/alias/git-bnm/index.md b/doc/git-bnm/index.md similarity index 58% rename from doc/alias/git-bnm/index.md rename to doc/git-bnm/index.md index 512c6112..bb6bb3de 100644 --- a/doc/alias/git-bnm/index.md +++ b/doc/git-bnm/index.md @@ -1,9 +1,11 @@ # git bnm -## List branches whose tips are not reachable from the specified commit (HEAD if not specified). +## List branches whose tips are not reachable from the specified commit (HEAD if not specified) -```gitconfig +Git alias: + +```git bnm = branch --no-merged ``` -Compare [bm](git-bm) +Compare [bm](../git-bm) diff --git a/doc/git-branch-commit-first/index.md b/doc/git-branch-commit-first/index.md new file mode 100644 index 00000000..2485cf0f --- /dev/null +++ b/doc/git-branch-commit-first/index.md @@ -0,0 +1,52 @@ +# git branch-commit-first + +## Show a branch's first commit hash (or hashes) + +Git alias: + +```git +branch-commit-first = "!f() { \ + branch="${1:-$(git current-branch)}"; \ + count="${2:-1}"; \ + git log --reverse --pretty=%H "$branch" | \ + head -"$count"; \ +}; f" +``` + +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/index.md b/doc/git-branch-commit-last/index.md new file mode 100644 index 00000000..47a6c827 --- /dev/null +++ b/doc/git-branch-commit-last/index.md @@ -0,0 +1,51 @@ +# git branch-commit-last + +## Show a branch's last commit hash (or hashes) + +Git alias: + +```git +branch-commit-last = "!f() { \ + branch="${1:-$(git current-branch)}"; \ + count="${2:-1}"; \ + git log --pretty=%H "$branch" | \ + head -"$count"; \ +}; f" +``` + +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/index.md b/doc/git-branch-commit-next/index.md new file mode 100644 index 00000000..8f471b57 --- /dev/null +++ b/doc/git-branch-commit-next/index.md @@ -0,0 +1,55 @@ +# git branch-commit-next + +## Show a branch's next commit hash (or hashes) + +Git alias: + +```git +branch-commit-next = "!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" +``` + +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]() +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/index.md b/doc/git-branch-commit-prev/index.md new file mode 100644 index 00000000..a70b07c2 --- /dev/null +++ b/doc/git-branch-commit-prev/index.md @@ -0,0 +1,52 @@ +# git branch-commit-prev + +## Show a branch's previous commit hash (or hashes) + +Git alias: + +```git +branch-commit-prev = "!f() { \ + branch="${1:-$(git current-branch)}"; \ + count="${2:-1}"; \ + git log --pretty=%H "$branch" | \ + grep -A "$count" $(git rev-parse HEAD) | \ + tail +2; \ +}; f" +``` + +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/index.md b/doc/git-branch-commit/index.md new file mode 100644 index 00000000..21b10ed8 --- /dev/null +++ b/doc/git-branch-commit/index.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 + + * https://github.com/hutusi/git-paging diff --git a/doc/alias/git-branch-name/index.md b/doc/git-branch-name/index.md similarity index 71% rename from doc/alias/git-branch-name/index.md rename to doc/git-branch-name/index.md index cfc77a11..82e872a6 100644 --- a/doc/alias/git-branch-name/index.md +++ b/doc/git-branch-name/index.md @@ -2,13 +2,15 @@ ## Get the current branch name -```gitconfig +Git alias: + +```git branch-name = rev-parse --abbrev-ref HEAD ``` Example: -```sh -$ git current-branch +```shell +git current-branch main ``` diff --git a/doc/git-branch/index.md b/doc/git-branch/index.md new file mode 100644 index 00000000..faf64ec1 --- /dev/null +++ b/doc/git-branch/index.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/alias/git-branches/index.md b/doc/git-branches/index.md similarity index 84% rename from doc/alias/git-branches/index.md rename to doc/git-branches/index.md index 971f7713..f5d264e2 100644 --- a/doc/alias/git-branches/index.md +++ b/doc/git-branches/index.md @@ -2,13 +2,15 @@ ## List branches -```gitconfig +Git alias: + +```git branches = branch -a ``` This alias is because friendly wording is easier to remember. -Our friendly wording for plurals: +Our friendly wording for plurals: * [git aliases](../git-aliases) diff --git a/doc/alias/git-bsd/index.md b/doc/git-bsd/index.md similarity index 80% rename from doc/alias/git-bsd/index.md rename to doc/git-bsd/index.md index 0f4776c3..dccaef07 100644 --- a/doc/alias/git-bsd/index.md +++ b/doc/git-bsd/index.md @@ -2,7 +2,9 @@ ## Show the description of a branch -```gitconfig +Git alias: + +```git bsd = "!f(){ \ branch=\"${1:-$(git rev-parse --abbrev-ref HEAD 2>/dev/null)}\"; \ git config \"branch.$branch.description\"; \ @@ -11,12 +13,12 @@ bsd = "!f(){ \ Example: -```sh -$ git bsd +```shell +git bsd This is an example branch ``` -We advocate for git authors to add this feature +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/index.md b/doc/git-bv/index.md new file mode 100644 index 00000000..10c7f47c --- /dev/null +++ b/doc/git-bv/index.md @@ -0,0 +1,27 @@ +# git bv + +## List branch information with hash and subject + +Git alias: + +```git +bv = branch --verbose +``` + +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-bvv/index.md b/doc/git-bvv/index.md new file mode 100644 index 00000000..31df9b31 --- /dev/null +++ b/doc/git-bvv/index.md @@ -0,0 +1,27 @@ +# git bvv + +## List branch information with hash and subject and upstream + +Git alias: + +```git +bvv = branch --verbose --verbose +``` + +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-c/index.md b/doc/git-c/index.md new file mode 100644 index 00000000..d6971b2d --- /dev/null +++ b/doc/git-c/index.md @@ -0,0 +1,15 @@ +# git c + +## Short for "git commit" + +Git alias: + +```git +c = commit +``` + +Example: + +```shell +git c +``` diff --git a/doc/git-ca/index.md b/doc/git-ca/index.md new file mode 100644 index 00000000..d8533cd7 --- /dev/null +++ b/doc/git-ca/index.md @@ -0,0 +1,15 @@ +# git ca + +## Amend the tip of the current branch; do not create a new commit + +Git alias: + +```git +ca = commit --amend +``` + +Example: + +```shell +git ca +``` diff --git a/doc/git-cam/index.md b/doc/git-cam/index.md new file mode 100644 index 00000000..acf5b457 --- /dev/null +++ b/doc/git-cam/index.md @@ -0,0 +1,15 @@ +# git cam + +## Amend the tip of the current branch; edit the message + +Git alias: + +```git +cam = commit --amend --message +``` + +Example: + +```shell +git cam +``` diff --git a/doc/alias/git-cane/index.md b/doc/git-cane/index.md similarity index 77% rename from doc/alias/git-cane/index.md rename to doc/git-cane/index.md index 1b187c93..839dc17b 100644 --- a/doc/alias/git-cane/index.md +++ b/doc/git-cane/index.md @@ -2,12 +2,14 @@ ## Amend the tip of the current branch; do not edit the message -```gitconfig +Git alias: + +```git cane = commit --amend --no-edit ``` Example: -```sh -$ git cane +```shell +git cane ``` diff --git a/doc/alias/git-chart/index.md b/doc/git-chart/index.md similarity index 98% rename from doc/alias/git-chart/index.md rename to doc/git-chart/index.md index d688e2f0..98ccccb2 100644 --- a/doc/alias/git-chart/index.md +++ b/doc/git-chart/index.md @@ -2,7 +2,9 @@ ## Show a summary chart of activity per author -```gitconfig +Git alias: + +```git chart = "!f() { \ git log \ --format=oneline \ @@ -51,8 +53,8 @@ chart = "!f() { \ Example: -```sh -$ git chart +```shell +git chart ..X..........X...2..12 alice@example.com ....2..2..13.......... bob@example.com 2.....1....11......... carol@example.com diff --git a/doc/alias/git-cherry-pick-merge/index.md b/doc/git-cherry-pick-merge/index.md similarity index 85% rename from doc/alias/git-cherry-pick-merge/index.md rename to doc/git-cherry-pick-merge/index.md index 9675d008..082e3f93 100644 --- a/doc/alias/git-cherry-pick-merge/index.md +++ b/doc/git-cherry-pick-merge/index.md @@ -2,7 +2,9 @@ ## Cherry pick a merge commit -```gitconfig +Git alias: + +```git cherry-pick-merge = !"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'" @@ -14,6 +16,6 @@ TODO: write summary Example: -```sh -$ git cherry-pick-merge +```shell +git cherry-pick-merge ``` diff --git a/doc/git-churn/index.html b/doc/git-churn/index.html new file mode 100644 index 00000000..7381d399 --- /dev/null +++ b/doc/git-churn/index.html @@ -0,0 +1,97 @@ + + + + + + git churn - GitAlias + + + + + + + + + +
+

git churn

+

Show log of files that have many changes

+

Git alias:

+
churn = !"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"
+
+

Show churn for whole repo:

+
$ git churn
+
+

Show churn for specific directories:

+
$ git churn app lib
+
+

Show churn for a time range:

+
$ 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:

+
$ 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:

+
$ 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

    +
  • +
  • +

    Scriptified by Gary Bernhardt

    +
  • +
  • +

    Obtained from https://github.com/garybernhardt/dotfiles/blob/main/bin/git-churn

    +
  • +
  • +

    Comments by Mislav http://mislav.uniqpath.com/2014/02/hidden-documentation/

    +
  • +
  • +

    Edited for GitAlias.com repo by Joel Parker Henderson

    +
  • +
+ +
+ + + + + diff --git a/doc/alias/git-churn/index.md b/doc/git-churn/index.md similarity index 83% rename from doc/alias/git-churn/index.md rename to doc/git-churn/index.md index 48715003..dcfe36f9 100644 --- a/doc/alias/git-churn/index.md +++ b/doc/git-churn/index.md @@ -2,7 +2,9 @@ ## Show log of files that have many changes -```gitconfig +Git alias: + +```git churn = !"f() { \ git log \ --all \ @@ -19,20 +21,20 @@ churn = !"f() { \ Show churn for whole repo: -```sh -$ git churn +```shell +git churn ``` Show churn for specific directories: -```sh -$ git churn app lib +```shell +git churn app lib ``` Show churn for a time range: -```sh -$ git churn --since=1-month-ago +```shell +git churn --since=1-month-ago ``` These are all standard arguments to `git log`. @@ -44,8 +46,8 @@ 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: -```sh -$ git churn --since=1-month-ago app/ | tail +```shell +git churn --since=1-month-ago app/ | tail ``` This can also highlight potential problems with technical debt in a project. @@ -58,8 +60,8 @@ 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: -```sh -$ git log --format='%an' --since=1-month-ago app/controllers/api/ | sort | uniq -c | sort -rn | head +```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 @@ -67,7 +69,7 @@ $ git log --format='%an' --since=1-month-ago app/controllers/api/ | sort | uniq Credit: -* Written by (Corey Haines)[http://coreyhaines.com/] +* Written by [Corey Haines](http://coreyhaines.com/) * Scriptified by Gary Bernhardt diff --git a/doc/alias/git-ci/index.md b/doc/git-ci/index.md similarity index 69% rename from doc/alias/git-ci/index.md rename to doc/git-ci/index.md index a9ef1feb..00779376 100644 --- a/doc/alias/git-ci/index.md +++ b/doc/git-ci/index.md @@ -2,12 +2,14 @@ ## Commit interactive -```gitconfig +Git alias: + +```git ci = commit --interactive ``` Example: -```sh -$ git ci +```shell +git ci ``` diff --git a/doc/git-cleaner/index.html b/doc/git-cleaner/index.html new file mode 100644 index 00000000..85bbc9b7 --- /dev/null +++ b/doc/git-cleaner/index.html @@ -0,0 +1,57 @@ + + + + + + git cleaner - GitAlias + + + + + + + + + +
+

git cleaner

+

Use git clean to make everything pristine

+

Git alias:

+
cleaner = clean -ffdx
+
+

Example:

+
$ 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.
+
-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-cleaner/index.md b/doc/git-cleaner/index.md new file mode 100644 index 00000000..8fa0f22a --- /dev/null +++ b/doc/git-cleaner/index.md @@ -0,0 +1,28 @@ +# git cleaner + +## Clean a working tree using more powerful options + +Git alias: + +```git +cleaner = clean -dff +``` + +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-cleanest/index.md b/doc/git-cleanest/index.md new file mode 100644 index 00000000..cd6f4ea5 --- /dev/null +++ b/doc/git-cleanest/index.md @@ -0,0 +1,31 @@ +# git cleanest + +## Clean a working tree using the most powerful options + +Git alias: + +```git +cleanest = clean -dffx +``` + +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-cleanout/index.md b/doc/git-cleanout/index.md new file mode 100644 index 00000000..bbe0847e --- /dev/null +++ b/doc/git-cleanout/index.md @@ -0,0 +1,15 @@ +# git cleanout + +## Clean a working tree using typical options then checkout + +Git alias: + +```git +cleanout = !git clean -df && git checkout -- . +``` + +Example: + +```shell +git cleanout +``` diff --git a/doc/alias/git-clone-lean/index.md b/doc/git-clone-lean/index.md similarity index 90% rename from doc/alias/git-clone-lean/index.md rename to doc/git-clone-lean/index.md index 6fe7bdf4..28924be3 100644 --- a/doc/alias/git-clone-lean/index.md +++ b/doc/git-clone-lean/index.md @@ -2,14 +2,16 @@ ## Clone as lean as possible -```gitconfig -clone-lean = clone --depth 1 --filter=combine:blob:none+tree:0 --no-checkout +Git alias: + +```git +clone-lean = clone --depth 1 --filter=combine:blob:none+tree:0 --no-checkout ``` Example: -```sh -$ git clone-lean +```shell +git clone-lean ``` This alias skips fetching unneeded objects from the server. @@ -26,9 +28,9 @@ Command breakdown: * --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". + with: "multiple filter-specs cannot be combined". -This uses --filter=tree:0 added in Git 2.20 and --filter=combine +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: @@ -36,7 +38,7 @@ 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 +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. diff --git a/doc/git-cloner/index.md b/doc/git-cloner/index.md new file mode 100644 index 00000000..bf49d489 --- /dev/null +++ b/doc/git-cloner/index.md @@ -0,0 +1,15 @@ +# git cloner + +## Clone a repository using our recommended way i.e. recurse on all submodules + +Git alias: + +```git +cloner = clone --recurse-submodules +``` + +Example: + +```shell +git cloner +``` diff --git a/doc/alias/git-cm/index.md b/doc/git-cm/index.md similarity index 68% rename from doc/alias/git-cm/index.md rename to doc/git-cm/index.md index 75dcb9e6..c079c8e1 100644 --- a/doc/alias/git-cm/index.md +++ b/doc/git-cm/index.md @@ -2,12 +2,14 @@ ## Commit with a message -```gitconfig +Git alias: + +```git cm = commit --message ``` Example: -```sh -$ git cm +```shell +git cm ``` diff --git a/doc/alias/git-co/index.md b/doc/git-co/index.md similarity index 76% rename from doc/alias/git-co/index.md rename to doc/git-co/index.md index 65cdd5af..ff01a9d9 100644 --- a/doc/alias/git-co/index.md +++ b/doc/git-co/index.md @@ -2,12 +2,14 @@ ## Checkout a.k.a. update the working tree to match a branch or paths -```gitconfig +Git alias: + +```git co = checkout ``` Example: -```sh -$ git co +```shell +git co ``` diff --git a/doc/alias/git-cog/index.md b/doc/git-cog/index.md similarity index 68% rename from doc/alias/git-cog/index.md rename to doc/git-cog/index.md index 166d26ac..fe869cfe 100644 --- a/doc/alias/git-cog/index.md +++ b/doc/git-cog/index.md @@ -2,12 +2,14 @@ ## Checkout with guessing -```gitconfig +Git alias: + +```git cog = checkout --guess ``` Example: -```sh -$ git cog +```shell +git cog ``` diff --git a/doc/alias/git-commit-is-merge/index.md b/doc/git-commit-is-merge/index.md similarity index 62% rename from doc/alias/git-commit-is-merge/index.md rename to doc/git-commit-is-merge/index.md index a129acf9..39f219e0 100644 --- a/doc/alias/git-commit-is-merge/index.md +++ b/doc/git-commit-is-merge/index.md @@ -1,8 +1,10 @@ -# git commit-is-merge +# git commit-is-merge ## Is the commit a merge commit? If yes exit 0, else exit 1 -```gitconfig +Git alias: + +```git commit-is-merge = !"f(){ \ [ -n \"$(git commit-parents \"$*\" | sed '0,/^parent /d')\" ]; \ };f" @@ -10,6 +12,6 @@ commit-is-merge = !"f(){ \ Example: -```sh -$ git commit-is-merge && do-something || do-something-else +```shell +git commit-is-merge && do-something || do-something-else ``` diff --git a/doc/alias/git-commit-message-key-lines/index.md b/doc/git-commit-message-key-lines/index.md similarity index 77% rename from doc/alias/git-commit-message-key-lines/index.md rename to doc/git-commit-message-key-lines/index.md index 2ec5b23c..6a3996fb 100644 --- a/doc/alias/git-commit-message-key-lines/index.md +++ b/doc/git-commit-message-key-lines/index.md @@ -1,8 +1,10 @@ # git commit-message-key-lines -## Show the commit's keyword-marker lines. +## Show the commit's keyword-marker lines -```gitconfig +Git alias: + +```git commit-message-key-lines = "!f(){ \ echo \"Commit: $1\"; git log \"$1\" --format=fuller | \ grep \"^[[:blank:]]*[[:alnum:]][-[:alnum:]]*:\" | \ @@ -12,17 +14,17 @@ commit-message-key-lines = "!f(){ \ Example: -```sh -$ git commit-message-key-lines ce505d161fccdbc8d4bf12047846de7433ad6d04 +```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), +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: -```sh +```shell commit ce505d161fccdbc8d4bf12047846de7433ad6d04 Author: Alice Adams Date: Tue May 28 11:53:47 2019 -0700 @@ -37,13 +39,13 @@ Date: Tue May 28 11:53:47 2019 -0700 Example command: -```sh -$ git commit-message-key-lines ce505d161fccdbc8d4bf12047846de7433ad6d04 +```shell +git commit-message-key-lines ce505d161fccdbc8d4bf12047846de7433ad6d04 ``` Example output: -```sh +```shell Commit: ce505d161fccdbc8d4bf12047846de7433ad6d04 Author: Alice Adams Date: Tue May 28 11:53:47 2019 -0700 diff --git a/doc/alias/git-commit-parents/index.md b/doc/git-commit-parents/index.md similarity index 79% rename from doc/alias/git-commit-parents/index.md rename to doc/git-commit-parents/index.md index 6b7b1c91..680620a1 100644 --- a/doc/alias/git-commit-parents/index.md +++ b/doc/git-commit-parents/index.md @@ -2,7 +2,9 @@ ## Show the commit's parents -```gitconfig +Git alias: + +```git commit-parents = !"f(){ \ git cat-file -p \"${*:-HEAD}\" | \ sed -n '/0/,/^ *$/{/^parent /p}'; \ @@ -11,6 +13,6 @@ commit-parents = !"f(){ \ Example: -```sh -$ git commit-parents +```shell +git commit-parents ``` diff --git a/doc/alias/git-cong/index.md b/doc/git-cong/index.md similarity index 70% rename from doc/alias/git-cong/index.md rename to doc/git-cong/index.md index 0425b1b9..859a4f9d 100644 --- a/doc/alias/git-cong/index.md +++ b/doc/git-cong/index.md @@ -2,12 +2,14 @@ ## Checkout with no guessing -```gitconfig +Git alias: + +```git cong = checkout --no-guess ``` Example: -```sh -$ git cong +```shell +git cong ``` diff --git a/doc/git-count/index.md b/doc/git-count/index.md new file mode 100644 index 00000000..e69de29b diff --git a/doc/alias/git-cp/index.md b/doc/git-cp/index.md similarity index 81% rename from doc/alias/git-cp/index.md rename to doc/git-cp/index.md index 767ff86b..7c9ead9a 100644 --- a/doc/alias/git-cp/index.md +++ b/doc/git-cp/index.md @@ -1,15 +1,17 @@ # git cp -## Cherry-pick - apply the changes introduced by some existing commits; +## Cherry-pick - apply the changes introduced by some existing commits; -```gitconfig +Git alias: + +```git cp = cherry-pick ``` Example: -```sh -$ git cp +```shell +git cp ``` Cherry pick is useful for moving small chunks of code between branches. diff --git a/doc/alias/git-cpa/index.md b/doc/git-cpa/index.md similarity index 71% rename from doc/alias/git-cpa/index.md rename to doc/git-cpa/index.md index 66c1f679..27e294a1 100644 --- a/doc/alias/git-cpa/index.md +++ b/doc/git-cpa/index.md @@ -2,12 +2,14 @@ ## Abort the cherry-pick process -```gitconfig +Git alias: + +```git cpa = cherry-pick --abort ``` Example: -```sh -$ git cpa +```shell +git cpa ``` diff --git a/doc/alias/git-cpc/index.md b/doc/git-cpc/index.md similarity index 72% rename from doc/alias/git-cpc/index.md rename to doc/git-cpc/index.md index 6a901e48..bfc8d24c 100644 --- a/doc/alias/git-cpc/index.md +++ b/doc/git-cpc/index.md @@ -2,12 +2,14 @@ ## Continue the cherry-pick process -```gitconfig +Git alias: + +```git cpc = cherry-pick --continue ``` Example: -```sh -$ git cpc +```shell +git cpc ``` diff --git a/doc/alias/git-cpn/index.md b/doc/git-cpn/index.md similarity index 69% rename from doc/alias/git-cpn/index.md rename to doc/git-cpn/index.md index f16d0ea2..7d2d987e 100644 --- a/doc/alias/git-cpn/index.md +++ b/doc/git-cpn/index.md @@ -2,12 +2,14 @@ ## Cherry-pick with no commit -```gitconfig +Git alias: + +```git cpn = cherry-pick -n ``` Example: -```sh -$ git cpn +```shell +git cpn ``` diff --git a/doc/alias/git-cpnx/index.md b/doc/git-cpnx/index.md similarity index 70% rename from doc/alias/git-cpnx/index.md rename to doc/git-cpnx/index.md index c79db26f..d7dc8df0 100644 --- a/doc/alias/git-cpnx/index.md +++ b/doc/git-cpnx/index.md @@ -2,17 +2,19 @@ ## Cherry-pick with no commit and with explanation -```gitconfig +Git alias: + +```git cpnx = cherry-pick -n -x ``` Example: -```sh -$ git cpnx +```shell +git cpnx ``` Cherry-pick with without making a commit. -When when recording the commit, append a line +When when recording the commit, append a line that says "(cherry picked from commit ...)" diff --git a/doc/git-cvs-e/index.md b/doc/git-cvs-e/index.md new file mode 100644 index 00000000..c3e8f9f3 --- /dev/null +++ b/doc/git-cvs-e/index.md @@ -0,0 +1,15 @@ +# git cvs-e + +## CVS export + +Git alias: + +```git +cvs-e = cvsexportcommit -u -p +``` + +Example: + +```shell +git cvs-e +``` diff --git a/doc/git-cvs-i/index.md b/doc/git-cvs-i/index.md new file mode 100644 index 00000000..b72faa5b --- /dev/null +++ b/doc/git-cvs-i/index.md @@ -0,0 +1,15 @@ +# git cvs-i + +## CVS import + +Git alias: + +```git +cvs-i = cvsimport -k -a +``` + +Example: + +```shell +git cvs-i +``` diff --git a/doc/alias/git-cvs/index.md b/doc/git-cvs/index.md similarity index 73% rename from doc/alias/git-cvs/index.md rename to doc/git-cvs/index.md index db51d19f..84f88fb9 100644 --- a/doc/alias/git-cvs/index.md +++ b/doc/git-cvs/index.md @@ -2,14 +2,16 @@ ## Aliases for working with CVS version control -```gitconfig +Git alias: + +```git cvs-i = cvsimport -k -a cvs-e = cvsexportcommit -u -p ``` Example: -```sh -$ git cvs-i -$ git cvs-e +```shell +git cvs-i +git cvs-e ``` diff --git a/doc/git-d/index.md b/doc/git-d/index.md new file mode 100644 index 00000000..fb19c563 --- /dev/null +++ b/doc/git-d/index.md @@ -0,0 +1,15 @@ +# git d + +## Short for "git diff" + +Git alias: + +```git +d = diff +``` + +Example: + +```shell +git d +``` diff --git a/doc/alias/git-dc/index.md b/doc/git-dc/index.md similarity index 74% rename from doc/alias/git-dc/index.md rename to doc/git-dc/index.md index d5100b4d..db4c58f6 100644 --- a/doc/alias/git-dc/index.md +++ b/doc/git-dc/index.md @@ -2,12 +2,14 @@ ## Diff in order to show changes not yet staged -```gitconfig +Git alias: + +```git dc = diff --cached ``` Example: -```sh -$ git dc +```shell +git dc ``` diff --git a/doc/alias/git-dd/index.md b/doc/git-dd/index.md similarity index 84% rename from doc/alias/git-dd/index.md rename to doc/git-dd/index.md index 175fe4b8..fe72bbf6 100644 --- a/doc/alias/git-dd/index.md +++ b/doc/git-dd/index.md @@ -2,14 +2,16 @@ ## Diff deep - show changes with our preferred options -```gitconfig +Git alias: + +```git dd = diff --check --dirstat --find-copies --find-renames --histogram --color ``` Example: -```sh -$ git dd +```shell +git dd ``` Also aliased as `diff-deep`. diff --git a/doc/alias/git-debug/index.md b/doc/git-debug/index.md similarity index 89% rename from doc/alias/git-debug/index.md rename to doc/git-debug/index.md index 0c4d2b81..3fe50498 100644 --- a/doc/alias/git-debug/index.md +++ b/doc/git-debug/index.md @@ -2,19 +2,21 @@ ## Help debugging builtins -```gitconfig +Git alias: + +```git debug = !GIT_PAGER= gdb --args git ``` Example: -```sh -$ git debug +```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 +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/index.md b/doc/git-default-branch/index.md new file mode 100644 index 00000000..e62569bc --- /dev/null +++ b/doc/git-default-branch/index.md @@ -0,0 +1,16 @@ +# git default-branch + +## Get the default branch name + +Git alias: + +```git +default-branch = config init.defaultBranch +``` + +Example: + +```shell +git default-branch +main +``` diff --git a/doc/git-diff-all/index.md b/doc/git-diff-all/index.md new file mode 100644 index 00000000..da0ee1a2 --- /dev/null +++ b/doc/git-diff-all/index.md @@ -0,0 +1,15 @@ +# git diff-all + +## For each diff, call difftool + +Git alias: + +```git +diff-all = !"for name in $(git diff --name-only $1); do git difftool $1 $name & done" +``` + +Example: + +```shell +git diff-all +``` diff --git a/doc/git-diff-changes/index.md b/doc/git-diff-changes/index.md new file mode 100644 index 00000000..663f356b --- /dev/null +++ b/doc/git-diff-changes/index.md @@ -0,0 +1,15 @@ +# git diff-changes + +## Show diff of changes + +Git alias: + +```git +diff-changes = diff --name-status -r +``` + +Example: + +```shell +git diff-changes +``` diff --git a/doc/alias/git-diff-chunk/index.md b/doc/git-diff-chunk/index.md similarity index 81% rename from doc/alias/git-diff-chunk/index.md rename to doc/git-diff-chunk/index.md index a869407d..cb1d70bd 100644 --- a/doc/alias/git-diff-chunk/index.md +++ b/doc/git-diff-chunk/index.md @@ -2,18 +2,20 @@ ## Show the diff of one chunk -```gitconfig +Git alias: + +```git diff-chunk = "!f() { \ git show \"\$1:\$3\" | sed -n \"/^[^ \t].*\$4(/,/^}/p\" > .tmp1 ; \ git show \"\$2:\$3\" | sed -n \"/^[^ \t].*\$4(/,/^}/p\" > .tmp2 ; \ git diff --no-index .tmp1 .tmp2 ; \ -}; f" +}; f" ``` Example: -```sh -$ git diff-chunk +```shell +git diff-chunk ``` Suppose we want to see just the differences of one chunk, @@ -24,6 +26,6 @@ then does a typical git diff. Syntax: -```sh -$ git funcdiff +```shell +git funcdiff ``` diff --git a/doc/git-diff-deep/index.md b/doc/git-diff-deep/index.md new file mode 100644 index 00000000..08a9c30a --- /dev/null +++ b/doc/git-diff-deep/index.md @@ -0,0 +1,15 @@ +# git diff-deep + +## Diff with deep information using our preferred options, a.k.a. `dd` + +Git alias: + +```git +diff-deep = diff --check --dirstat --find-copies --find-renames --histogram --color +``` + +Example: + +```shell +git diff-deep +``` diff --git a/doc/git-diff-staged/index.md b/doc/git-diff-staged/index.md new file mode 100644 index 00000000..3bb0ea5f --- /dev/null +++ b/doc/git-diff-staged/index.md @@ -0,0 +1,15 @@ +# git diff-staged + +## Show diffs that are cached i.e. staged + +Git alias: + +```git +diff-staged = diff --cached +``` + +Example: + +```shell +git diff-staged +``` diff --git a/doc/git-diff-stat/index.md b/doc/git-diff-stat/index.md new file mode 100644 index 00000000..410f2929 --- /dev/null +++ b/doc/git-diff-stat/index.md @@ -0,0 +1,15 @@ +# git diff-stat + +## Diff with stat + +Git alias: + +```git +diff-stat = diff --stat --ignore-space-change -r +``` + +Example: + +```shell +git diff-stat +``` diff --git a/doc/alias/git-diff/index.md b/doc/git-diff/index.md similarity index 82% rename from doc/alias/git-diff/index.md rename to doc/git-diff/index.md index 88d11f2b..e9e17e20 100644 --- a/doc/alias/git-diff/index.md +++ b/doc/git-diff/index.md @@ -2,7 +2,9 @@ ## Show diff in various ways -```gitconfig +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 @@ -14,9 +16,9 @@ diff-deep = diff --check --dirstat --find-copies --find-renames --histogram --co Example: -```sh -$ git diff-all -$ git diff-changes -$ git diff-stat -$ git diff-deep +```shell +git diff-all +git diff-changes +git diff-stat +git diff-deep ``` diff --git a/doc/git-discard/index.md b/doc/git-discard/index.md new file mode 100644 index 00000000..9a501ccd --- /dev/null +++ b/doc/git-discard/index.md @@ -0,0 +1,13 @@ +# git discard + +## Discard changes in a file (or a list of files) in working tree + +```gitalias +discard = checkout -- +``` + +Example: + +```shell +git discard foo goo hoo +``` diff --git a/doc/alias/git-ds/index.md b/doc/git-ds/index.md similarity index 71% rename from doc/alias/git-ds/index.md rename to doc/git-ds/index.md index be89c7e3..d56dfec1 100644 --- a/doc/alias/git-ds/index.md +++ b/doc/git-ds/index.md @@ -2,12 +2,14 @@ ## Show changes about to be commited -```gitconfig +Git alias: + +```git ds = diff --staged ``` Example: -```sh -$ git ds +```shell +git ds ``` diff --git a/doc/git-dw/index.md b/doc/git-dw/index.md new file mode 100644 index 00000000..c4367d0f --- /dev/null +++ b/doc/git-dw/index.md @@ -0,0 +1,15 @@ +# git dw + +## Show changes by word, not line + +Git alias: + +```git +dw = diff --word-diff +``` + +Example: + +```shell +git dw +``` diff --git a/doc/alias/git-dwd/index.md b/doc/git-dwd/index.md similarity index 71% rename from doc/alias/git-dwd/index.md rename to doc/git-dwd/index.md index 7306d64b..e7d13317 100644 --- a/doc/alias/git-dwd/index.md +++ b/doc/git-dwd/index.md @@ -2,12 +2,14 @@ ## Show changes by word, not by line -```gitconfig +Git alias: + +```git dwd = diff --word-diff ``` Example: -```sh -$ git dwd +```shell +git dwd ``` diff --git a/doc/git-edit-cached/index.md b/doc/git-edit-cached/index.md new file mode 100644 index 00000000..b924312a --- /dev/null +++ b/doc/git-edit-cached/index.md @@ -0,0 +1,37 @@ +# git edit-cached + +## Edit cached files + +Git alias: + +```git +edit-cached = !"f() { git ls-files --cached | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +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/index.md b/doc/git-edit-deleted/index.md new file mode 100644 index 00000000..3d6388d2 --- /dev/null +++ b/doc/git-edit-deleted/index.md @@ -0,0 +1,37 @@ +# git edit-deleted + +## Edit deleted files + +Git alias: + +```git +edit-deleted = !"f() { git ls-files --deleted | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +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/index.md b/doc/git-edit-ignored/index.md new file mode 100644 index 00000000..d9686114 --- /dev/null +++ b/doc/git-edit-ignored/index.md @@ -0,0 +1,37 @@ +# git edit-ignored + +## Edit ignored files + +Git alias: + +```git +edit-ignored = !"f() { git ls-files --ignored | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +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/index.md b/doc/git-edit-killed/index.md new file mode 100644 index 00000000..33c4054f --- /dev/null +++ b/doc/git-edit-killed/index.md @@ -0,0 +1,37 @@ +# git edit-killed + +## Edit killed files + +Git alias: + +```git +edit-killed = !"f() { git ls-files --killed | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +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/index.md b/doc/git-edit-modified/index.md new file mode 100644 index 00000000..3f6713b5 --- /dev/null +++ b/doc/git-edit-modified/index.md @@ -0,0 +1,37 @@ +# git edit-modified + +## Edit modified files + +Git alias: + +```git +edit-modified = !"f() { git ls-files --modified | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +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/index.md b/doc/git-edit-others/index.md new file mode 100644 index 00000000..141f9ee0 --- /dev/null +++ b/doc/git-edit-others/index.md @@ -0,0 +1,37 @@ +# git edit-others + +## Edit other files + +Git alias: + +```git +edit-others = !"f() { git ls-files --others | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +Example: + +```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/index.md b/doc/git-edit-stage/index.md new file mode 100644 index 00000000..3c2448fc --- /dev/null +++ b/doc/git-edit-stage/index.md @@ -0,0 +1,37 @@ +# git edit-stage + +## Edit stage files + +Git alias: + +```git +edit-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +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/index.md b/doc/git-edit-unmerged/index.md new file mode 100644 index 00000000..61c7f277 --- /dev/null +++ b/doc/git-edit-unmerged/index.md @@ -0,0 +1,37 @@ +# git edit-unmerged + +## Edit unmerged files + +Git alias: + +```git +edit-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`" +``` + +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/alias/git-edit/index.md b/doc/git-edit/index.md similarity index 83% rename from doc/alias/git-edit/index.md rename to doc/git-edit/index.md index 1b0c37f6..b30fc6d5 100644 --- a/doc/alias/git-edit/index.md +++ b/doc/git-edit/index.md @@ -2,7 +2,9 @@ ## Edit all files of a given type -```gitconfig +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`" @@ -15,15 +17,15 @@ edit-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; `git va Example: -```sh -$ git edit-cached -$ git edit-deleted -$ git edit-others -$ git edit-ignored -$ git edit-killed -$ git edit-modified -$ git edit-stage -$ git edit-unmerged +```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/index.html b/doc/git-exec/index.html new file mode 100644 index 00000000..4df778b6 --- /dev/null +++ b/doc/git-exec/index.html @@ -0,0 +1,29 @@ + + + + + + git exec - GitAlias.com + + + + +
+
+

git exec

+

Execute a shell script

+
exec = ! exec
+
+

Example:

+
$ git exec pwd
+/home/alice/projects/example
+
+

Note: git always runs scripts in the top directory.

+ +
+
+ + diff --git a/doc/alias/git-exec/index.md b/doc/git-exec/index.md similarity index 78% rename from doc/alias/git-exec/index.md rename to doc/git-exec/index.md index 5a14f9eb..a491eade 100644 --- a/doc/alias/git-exec/index.md +++ b/doc/git-exec/index.md @@ -2,14 +2,16 @@ ## Execute a shell script -```gitconfig +Git alias: + +```git exec = ! exec ``` Example: -```sh -$ git exec pwd +```shell +git exec pwd /home/alice/projects/example ``` diff --git a/doc/git-expunge/index.html b/doc/git-expunge/index.html new file mode 100644 index 00000000..445086e5 --- /dev/null +++ b/doc/git-expunge/index.html @@ -0,0 +1,38 @@ + + + + + + git expunge - GitAlias.com + + + + +
+
+

git expunge

+

Delete a file everywhere

+
expunge = !"f() { \
+    git filter-branch \
+    --force \
+    --index-filter \"git rm --cached --ignore-unmatch $1\" \
+    --prune-empty \
+    --tag-name-filter cat -- --all \
+}; f"
+
+

Example:

+
$ 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 https://help.github.com/articles/removing-sensitive-data-from-a-repository/

+ +
+
+ + diff --git a/doc/alias/git-expunge/index.md b/doc/git-expunge/index.md similarity index 90% rename from doc/alias/git-expunge/index.md rename to doc/git-expunge/index.md index a5b1408f..53f375f5 100644 --- a/doc/alias/git-expunge/index.md +++ b/doc/git-expunge/index.md @@ -2,7 +2,9 @@ ## Delete a file everywhere -```gitconfig +Git alias: + +```git expunge = !"f() { \ git filter-branch \ --force \ @@ -14,12 +16,12 @@ expunge = !"f() { \ Example: -```sh -$ git expunge file.txt +```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 +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. diff --git a/doc/git-f/index.md b/doc/git-f/index.md new file mode 100644 index 00000000..50b003f6 --- /dev/null +++ b/doc/git-f/index.md @@ -0,0 +1,15 @@ +# git f + +## Short for "git fetch" + +Git alias: + +```git +f = fetch +``` + +Example: + +```shell +git f +``` diff --git a/doc/git-fa/index.md b/doc/git-fa/index.md new file mode 100644 index 00000000..ec7af359 --- /dev/null +++ b/doc/git-fa/index.md @@ -0,0 +1,15 @@ +# git fa + +## Fetch all remotes + +Git alias: + +```git +fa = fetch --all +``` + +Example: + +```shell +git fa +``` diff --git a/doc/git-fav/index.md b/doc/git-fav/index.md new file mode 100644 index 00000000..7c9ab2a0 --- /dev/null +++ b/doc/git-fav/index.md @@ -0,0 +1,15 @@ +# git fav + +## Fetch all remotes, with verbose output + +Git alias: + +```git +fav = fetch --all --verbose +``` + +Example: + +```shell +git fav +``` diff --git a/doc/alias/git-fixup/index.md b/doc/git-fixup/index.md similarity index 80% rename from doc/alias/git-fixup/index.md rename to doc/git-fixup/index.md index 3717ae1b..5dff0b3c 100644 --- a/doc/alias/git-fixup/index.md +++ b/doc/git-fixup/index.md @@ -2,17 +2,19 @@ ## Fix a commit by amending it -```gitconfig +Git alias: + +```git fixup = "!f() { \ TARGET=$(git rev-parse \"$1\"); \ - git commit --fixup=$TARGET && \ + git commit --fixup=$TARGET && \ GIT_EDITOR=true git rebase --interactive --autosquash $TARGET~; \ }; f" Example: -```sh -$ git fixup +```shell +git fixup ``` See https://blog.filippo.io/git-fixup-amending-an-older-commit/ diff --git a/doc/alias/git-g/index.md b/doc/git-g/index.md similarity index 69% rename from doc/alias/git-g/index.md rename to doc/git-g/index.md index 11f656e3..b3d5f642 100644 --- a/doc/alias/git-g/index.md +++ b/doc/git-g/index.md @@ -1,15 +1,17 @@ # git g -## Shortcut for "grep" +## Short for "git grep" -```gitconfig +Git alias: + +```git g = grep ``` Example: -```sh -$ git g +```shell +git g ``` This will search for text. diff --git a/doc/alias/git-get-git-put/index.md b/doc/git-get-git-put/index.md similarity index 70% rename from doc/alias/git-get-git-put/index.md rename to doc/git-get-git-put/index.md index 3ab685ad..bb3d66fd 100644 --- a/doc/alias/git-get-git-put/index.md +++ b/doc/git-get-git-put/index.md @@ -2,16 +2,18 @@ ## Synchronize changes for the current branch -```gitconfig +Git alias: + +```git get = !git fetch --prune && git pull --rebase && git submodule update --init --recursive put = !git commit --all && git push ``` Example: -```sh -$ git get -$ git put +```shell +git get +git put ``` Our workflow does these steps: @@ -22,14 +24,22 @@ Our workflow does these steps: If you want to preserve merges, then we recommend you set this: -```sh -$ git config pull.rebase preserve +```shell +git config pull.rebase preserve ``` -TODO: +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/index.md b/doc/git-get/index.md new file mode 100644 index 00000000..cefbc494 --- /dev/null +++ b/doc/git-get/index.md @@ -0,0 +1,23 @@ +# git get + +## Get all changes for the current branch + +Git alias: + +```git +get = !git fetch --prune && git pull --rebase && git submodule update --init --recursive +``` + +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/alias/git-gg/index.md b/doc/git-gg/index.md similarity index 84% rename from doc/alias/git-gg/index.md rename to doc/git-gg/index.md index efc82c7d..4dbd6bf0 100644 --- a/doc/alias/git-gg/index.md +++ b/doc/git-gg/index.md @@ -2,14 +2,16 @@ ## Grep group i.e. search with our preferred options -```gitconfig +Git alias: + +```git gg = grep --break --heading --line-number --color ``` Example: -```sh -$ git gg +```shell +git gg ``` Also aliased as [git grep-group](../git-grep-group). diff --git a/doc/alias/git-gitk-conflict/index.md b/doc/git-gitk-conflict/index.md similarity index 74% rename from doc/alias/git-gitk-conflict/index.md rename to doc/git-gitk-conflict/index.md index cce079e8..8ef5e512 100644 --- a/doc/alias/git-gitk-conflict/index.md +++ b/doc/git-gitk-conflict/index.md @@ -2,12 +2,14 @@ ## Use gitk tool to show conflicting merge -```gitconfig +Git alias: + +```git gitk-conflict = !gitk --left-right HEAD...MERGE_HEAD ``` Example: -```sh -$ git gitk-conflict +```shell +git gitk-conflict ``` diff --git a/doc/alias/git-gitk-history-all/index.md b/doc/git-gitk-history-all/index.md similarity index 62% rename from doc/alias/git-gitk-history-all/index.md rename to doc/git-gitk-history-all/index.md index 0e0b50ce..484e7849 100644 --- a/doc/alias/git-gitk-history-all/index.md +++ b/doc/git-gitk-history-all/index.md @@ -2,12 +2,16 @@ ## Use gitk tool to show full history, including "deleted" branches and stashes -```gitconfig +Git alias: + +```git gitk-history-all = !gitk --all $( git fsck | awk '/dangling commit/ {print $3}' ) ``` Example: -```sh -$ git gitk-history-all +```shell +git gitk-history-all ``` + +This will show full history, including "deleted" branches and stashes. diff --git a/doc/git-gitk/index.md b/doc/git-gitk/index.md new file mode 100644 index 00000000..6b6f3b56 --- /dev/null +++ b/doc/git-gitk/index.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-history-all) - Use gitk to show full history. diff --git a/doc/alias/git-gn/index.md b/doc/git-gn/index.md similarity index 66% rename from doc/alias/git-gn/index.md rename to doc/git-gn/index.md index f64bde71..4052fc3a 100644 --- a/doc/alias/git-gn/index.md +++ b/doc/git-gn/index.md @@ -2,14 +2,16 @@ ## Grep and show line number -```gitconfig -gn = grep -n +Git alias: + +```git +gn = grep -n ``` Example: -```sh -$ git gn +```shell +git gn ``` Same as `git grep --line-number`. diff --git a/doc/alias/git-graphviz/index.md b/doc/git-graphviz/index.md similarity index 65% rename from doc/alias/git-graphviz/index.md rename to doc/git-graphviz/index.md index f69ebcae..a12f7f82 100644 --- a/doc/alias/git-graphviz/index.md +++ b/doc/git-graphviz/index.md @@ -2,7 +2,9 @@ ## Use graphviz tool for display -```gitconfig +Git alias: + +```git graphviz = !"f() { \ echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; \ }; f" @@ -10,16 +12,16 @@ graphviz = !"f() { \ Example: -```sh -$ git graphviz +```shell +git graphviz ``` This produces output that can be displayed using dotty. Example: -```sh -$ git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin +```shell +git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin -$ git graphviz --first-parent main | dotty /dev/stdin +git graphviz --first-parent main | dotty /dev/stdin ``` diff --git a/doc/git-grep-ack/index.md b/doc/git-grep-ack/index.md new file mode 100644 index 00000000..e69de29b diff --git a/doc/git-grep-all/index.md b/doc/git-grep-all/index.md new file mode 100644 index 00000000..e3c5cfda --- /dev/null +++ b/doc/git-grep-all/index.md @@ -0,0 +1,21 @@ +# git grep-all + +## Find text in any commit ever + +Git alias: + +```git +grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f" +``` + +Syntax: + +```shell +git grep-all … +``` + +Example: + +```shell +git grep-all foo +``` diff --git a/doc/git-grep-group/index.md b/doc/git-grep-group/index.md new file mode 100644 index 00000000..f2613adc --- /dev/null +++ b/doc/git-grep-group/index.md @@ -0,0 +1,21 @@ +# git grep-group + +## Find text and group the output lines, a.k.a. `gg` + +Git alias: + +```git +grep-group = grep --break --heading --line-number --color +``` + +Syntax: + +```shell +git grep-group [options] +``` + +Example: + +```shell +git grep-group foo +``` diff --git a/doc/alias/git-grep/index.md b/doc/git-grep/index.md similarity index 87% rename from doc/alias/git-grep/index.md rename to doc/git-grep/index.md index 6c58bdc8..48ff5615 100644 --- a/doc/alias/git-grep/index.md +++ b/doc/git-grep/index.md @@ -2,7 +2,9 @@ ## Grep helpers -```gitconfig +Git alias: + +```git # Find text in any commit ever. grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f" @@ -19,8 +21,8 @@ grep-ack = \ Example: -```sh -$ git grep-all -$ git grep-group -$ git grep-ack +```shell +git grep-all +git grep-group +git grep-ack ``` diff --git a/doc/git-heads/index.md b/doc/git-heads/index.md new file mode 100644 index 00000000..5a1fe7ef --- /dev/null +++ b/doc/git-heads/index.md @@ -0,0 +1,17 @@ +# git heads + +## Show log of heads + +Git alias: + +```git +heads = !"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';'" +``` + +Example: + +```shell +git heads +``` + +From https://gist.github.com/492227 diff --git a/doc/git-hew-dry-run/index.md b/doc/git-hew-dry-run/index.md new file mode 100644 index 00000000..94a08865 --- /dev/null +++ b/doc/git-hew-dry-run/index.md @@ -0,0 +1,42 @@ +# git hew-dry-run + +## Delete all branches that have been merged into a commit (dry run) + +Git alias: + +```git +hew = !git hew-local-dry-run "$@" && git hew-remote-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/index.md b/doc/git-hew-local-dry-run/index.md new file mode 100644 index 00000000..82b4bee3 --- /dev/null +++ b/doc/git-hew-local-dry-run/index.md @@ -0,0 +1,50 @@ +# git hew-local-dry-run + +## Delete local branches that have been merged into a commit (dry run) + +Git alias: + +```git +hew-local = !"f() { \ + commit=${1:-$(git current-branch)}; \ + git branch --merged \"$commit\" | \ + grep -v \"^[[:space:]]*\\*[[:space:]]*$commit$\" ; \ +}; f \"$@\"" +``` + +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/index.md b/doc/git-hew-local/index.md new file mode 100644 index 00000000..77644f8f --- /dev/null +++ b/doc/git-hew-local/index.md @@ -0,0 +1,49 @@ +# git hew-local + +## Delete local branches that have been merged into a commit + +Git alias: + +```git +hew-local = !"f() { \ + hew-local-dry-run \"$@\" | \ + xargs git branch --delete ; \ +}; f \"$@\"" +``` + +Syntax: + +```shell +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/index.md b/doc/git-hew-remote/index.md new file mode 100644 index 00000000..21d21bc3 --- /dev/null +++ b/doc/git-hew-remote/index.md @@ -0,0 +1,49 @@ +# git hew-remote + +## Delete remote branches that have been merged into an upstream commit + +Git alias: + +```git +hew-remote = !"f() { \ + hew-remote-dry-run \"$@\" | \ + xargs -I% git push origin :% 2>&1 ; \ +}; f \"$@\"" +``` + +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/index.md b/doc/git-hew/index.md new file mode 100644 index 00000000..91f0cf84 --- /dev/null +++ b/doc/git-hew/index.md @@ -0,0 +1,42 @@ +# git hew + +## Delete all branches that have been merged into a commit + +Git alias: + +```git +hew = !git hew-local "$@" && git hew-remote "$@"; +``` + +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/index.md b/doc/git-ignore/index.md new file mode 100644 index 00000000..1b108a1c --- /dev/null +++ b/doc/git-ignore/index.md @@ -0,0 +1,15 @@ +# git ignore + +## Ignore all untracked files by appending them to ".gitignore" + +Git alias: + +```gitalias +ignore = "!git status | grep -P \"^\\t\" | grep -vF .gitignore | sed \"s/^\\t//\" >> .gitignore" +``` + +Example: + +```shell +git ignore +``` diff --git a/doc/alias/git-inbound/index.md b/doc/git-inbound/index.md similarity index 80% rename from doc/alias/git-inbound/index.md rename to doc/git-inbound/index.md index f13a6cb3..e3d5126a 100644 --- a/doc/alias/git-inbound/index.md +++ b/doc/git-inbound/index.md @@ -2,14 +2,16 @@ ## Show incoming changes compared to upstream -```gitconfig +Git alias: + +```git inbound = !git remote update --prune; git log ..@{upstream} ``` Example: -```sh -$ git inbound -``` +```shell +git inbound +``` Compare [git outbound](../git-outbound). diff --git a/doc/git-init-empty/index.md b/doc/git-init-empty/index.md new file mode 100644 index 00000000..c9088909 --- /dev/null +++ b/doc/git-init-empty/index.md @@ -0,0 +1,21 @@ +# git init-empty + +## Initalize a repo with an empty rebaseable commit + +Git alias: + +```git +init-empty = !"f() { \ + git init && \ + git commit --allow-empty --allow-empty-message --message ''; \ +}; f" +``` + +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/index.md b/doc/git-initer/index.md new file mode 100644 index 00000000..fec2165c --- /dev/null +++ b/doc/git-initer/index.md @@ -0,0 +1,21 @@ +# git initer + +## Initalize a repo using our recommended way i.e. with an empty rebaseable commit + +Git alias: + +```git +initer = init-empty +``` + +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/alias/git-intercommit/index.md b/doc/git-intercommit/index.md similarity index 90% rename from doc/alias/git-intercommit/index.md rename to doc/git-intercommit/index.md index 16190ca7..60e3a4fa 100644 --- a/doc/alias/git-intercommit/index.md +++ b/doc/git-intercommit/index.md @@ -2,14 +2,16 @@ ## Use interdiff to see patch modifications -```gitconfig +Git alias: + +```git intercommit = !sh -c 'git show "$1" > .git/commit1 && git show "$2" > .git/commit2 && interdiff .git/commit[12] | less -FRS' - ``` Example: -```sh -$ git intercommit +```shell +git intercommit ``` If upstream applied a slightly modified patch, and we want to see the diff --git a/doc/alias/git-issues/index.md b/doc/git-issues/index.md similarity index 82% rename from doc/alias/git-issues/index.md rename to doc/git-issues/index.md index daef771e..08107803 100644 --- a/doc/alias/git-issues/index.md +++ b/doc/git-issues/index.md @@ -2,31 +2,33 @@ ## List all issues mentioned in commit messages between range of commits -```gitconfig +Git alias: + +```git issues = !sh -c \"git log $1 --oneline | grep -o \\\"ISSUE-[0-9]\\+\\\" | sort -u\" ``` Example: -```sh -$ git issues +```shell +git issues ``` -You must adjust the alias regular expression `\\\"ISSUE-[0-9]\\+\\\"` +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: -```sh -$ git issues v1.0..v1.1 +```shell +git issues v1.0..v1.1 ``` This alias will work with any valid commit range: -```sh -$ git issues main..HEAD +```shell +git issues main..HEAD ``` diff --git a/doc/git-l/index.md b/doc/git-l/index.md new file mode 100644 index 00000000..16431bd9 --- /dev/null +++ b/doc/git-l/index.md @@ -0,0 +1,15 @@ +# git l + +## Short for "git log" + +Git alias: + +```git +l = log +``` + +Example: + +```shell +git l +``` diff --git a/doc/git-last-tag/index.md b/doc/git-last-tag/index.md new file mode 100644 index 00000000..80d0b355 --- /dev/null +++ b/doc/git-last-tag/index.md @@ -0,0 +1,25 @@ +# git last-tag + +## Show the last tag in the current branch + +Git alias: + +```git +last-tag = describe --tags --abbrev=0 +``` + +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-tagged/index.md b/doc/git-last-tagged/index.md new file mode 100644 index 00000000..e5516408 --- /dev/null +++ b/doc/git-last-tagged/index.md @@ -0,0 +1,15 @@ +# git last-tagged + +## Show the last annotated tag in all branches + +Git alias: + +```git +last-tagged = !git describe --tags `git rev-list --tags --max-count=1` +``` + +Example: + +```shell +git last-tagged +``` diff --git a/doc/alias/git-lfp/index.md b/doc/git-lfp/index.md similarity index 82% rename from doc/alias/git-lfp/index.md rename to doc/git-lfp/index.md index 575e1223..8cbc2ddd 100644 --- a/doc/alias/git-lfp/index.md +++ b/doc/git-lfp/index.md @@ -2,14 +2,16 @@ ## Log with first parent -```gitconfig +Git alias: + +```git lfp = log --first-parent ``` Example: -```sh -$ git lfp +```shell +git lfp ``` This alias can be useful for teamwork for a branch that only accepts pull requests. diff --git a/doc/alias/git-lg/index.md b/doc/git-lg/index.md similarity index 77% rename from doc/alias/git-lg/index.md rename to doc/git-lg/index.md index cbe7ec68..968867a8 100644 --- a/doc/alias/git-lg/index.md +++ b/doc/git-lg/index.md @@ -2,12 +2,14 @@ ## Log with a text-based graphical representation of the commit history -```gitconfig +Git alias: + +```git lg = log --graph ``` Example: -```sh -$ git lg +```shell +git lg ``` diff --git a/doc/git-ll/index.md b/doc/git-ll/index.md new file mode 100644 index 00000000..a6917031 --- /dev/null +++ b/doc/git-ll/index.md @@ -0,0 +1,47 @@ +# git ll + +## Log list - Show log list with our preferred options and short information + +Git alias: + +```git +ll = log \ + --graph \ + --topo-order \ + --decorate \ + --all \ + --boundary \ + --date=short \ + --abbrev-commit \ + --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' +``` + +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 commit format using abbreviated hexadecimal (not full hexadecimal) + + * Short author field using name (no email address) + + * 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 commit format using hash hexadecimal displayed as name-rev + + * Long author field using name and email address + + * Long layout with columns diff --git a/doc/alias/git-lll/index.md b/doc/git-lll/index.md similarity index 55% rename from doc/alias/git-lll/index.md rename to doc/git-lll/index.md index a8f1f3fd..deadee7f 100644 --- a/doc/alias/git-lll/index.md +++ b/doc/git-lll/index.md @@ -1,8 +1,10 @@ # git lll -## Log love long i.e. our preferred key performance indicators. +## Log list long - Show log list with our preferred options and long information -```gitconfig +Git alias: + +```git lll = log \ --graph \ --topo-order \ @@ -20,13 +22,25 @@ lll = log \ Example: -```sh -$ git lll +```shell +git lll * 2021-01-01T00:00:00+00:00 remotes/origin/main Add feature foo Alice Adams N … ``` -This alias `git lll` is the same as [git ll](../git-ll) except: +### 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 commit format using abbreviated hexadecimal (not full hexadecimal) + + * Short author field using name (no email address) + + * 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 @@ -34,4 +48,4 @@ This alias `git lll` is the same as [git ll](../git-ll) except: * Long author field using name and email address - * Long column layout + * Long layout with columns diff --git a/doc/alias/git-lo/index.md b/doc/git-lo/index.md similarity index 69% rename from doc/alias/git-lo/index.md rename to doc/git-lo/index.md index 7754c4e0..13aed388 100644 --- a/doc/alias/git-lo/index.md +++ b/doc/git-lo/index.md @@ -2,12 +2,14 @@ ## Log with one line per item -```gitconfig +Git alias: + +```git lo = log --oneline ``` Example: -```sh -$ git lo +```shell +git lo ``` diff --git a/doc/git-log-1-day/index.md b/doc/git-log-1-day/index.md new file mode 100644 index 00000000..2b4df638 --- /dev/null +++ b/doc/git-log-1-day/index.md @@ -0,0 +1,39 @@ +# git log-1-day + +## Show log with the recent day + +Git alias: + +```git +log-1-day = log --since=1-day-ago +``` + +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-hour/index.md b/doc/git-log-1-hour/index.md new file mode 100644 index 00000000..b2806504 --- /dev/null +++ b/doc/git-log-1-hour/index.md @@ -0,0 +1,39 @@ +# git log-1-hour + +## Show log with the recent hour + +Git alias: + +```git +log-1-hour = log --since=1-hour-ago +``` + +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-month/index.md b/doc/git-log-1-month/index.md new file mode 100644 index 00000000..6c98495d --- /dev/null +++ b/doc/git-log-1-month/index.md @@ -0,0 +1,39 @@ +# git log-1-month + +## Show log with the recent month + +Git alias: + +```git +log-1-month = log --since=1-month-ago +``` + +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-week/index.md b/doc/git-log-1-week/index.md new file mode 100644 index 00000000..8ddbf56e --- /dev/null +++ b/doc/git-log-1-week/index.md @@ -0,0 +1,39 @@ +# git log-1-week + +## Show log with the recent week + +Git alias: + +```git +log-1-week = log --since=1-week-ago +``` + +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-year/index.md b/doc/git-log-1-year/index.md new file mode 100644 index 00000000..038ee815 --- /dev/null +++ b/doc/git-log-1-year/index.md @@ -0,0 +1,39 @@ +# git log-1-year + +## Show log with the recent year + +Git alias: + +```git +log-1-year = log --since=1-year-ago +``` + +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-date-first/index.md b/doc/git-log-date-first/index.md new file mode 100644 index 00000000..8ec879a3 --- /dev/null +++ b/doc/git-log-date-first/index.md @@ -0,0 +1,18 @@ +# git log-date-first + +## Show the date of the earliest commit, in strict ISO 8601 format + +Git alias: + +```git +log-date-first = !"git log --date-order --format=%cI | tail -1" +``` + +Example: + +```shell +git log-date-first +``` + +Compare [git log-date-]ast](../git-log-date-last). + diff --git a/doc/git-log-date-last/index.md b/doc/git-log-date-last/index.md new file mode 100644 index 00000000..1c1d0810 --- /dev/null +++ b/doc/git-log-date-last/index.md @@ -0,0 +1,17 @@ +# git log-date-last + +## Show the date of the latest commit, in strict ISO 8601 format + +Git alias: + +```git +log-date-last = !"git log -1 --date-order --format=%cI" +``` + +Example: + +```shell +git log-date-last +``` + +Compare [git log-date-first](../git-log-date-first). diff --git a/doc/git-log-fetched/index.md b/doc/git-log-fetched/index.md new file mode 100644 index 00000000..46412f7b --- /dev/null +++ b/doc/git-log-fetched/index.md @@ -0,0 +1,17 @@ +# git log-fetched + +## Show log of fetched commits vs. origin/main + +Git alias: + +```git +log-fetched = log --oneline HEAD..origin/main +``` + +Example: + +```shell +git log-fetched +``` + +TODO: upgrade to make origin variable diff --git a/doc/git-log-fresh/index.md b/doc/git-log-fresh/index.md new file mode 100644 index 00000000..13b979d0 --- /dev/null +++ b/doc/git-log-fresh/index.md @@ -0,0 +1,15 @@ +# git log-fresh + +## Show log of new commits after you fetched, with stats, excluding merges + +Git alias: + +```git +log-fresh = log ORIG_HEAD.. --stat --no-merges +``` + +Example: + +```shell +git log-fresh +``` diff --git a/doc/git-log-graph/index.md b/doc/git-log-graph/index.md new file mode 100644 index 00000000..5e7e26b4 --- /dev/null +++ b/doc/git-log-graph/index.md @@ -0,0 +1,3 @@ +# git log-graph + +TODO diff --git a/doc/git-log-list-long/index.md b/doc/git-log-list-long/index.md new file mode 100644 index 00000000..5eabe828 --- /dev/null +++ b/doc/git-log-list-long/index.md @@ -0,0 +1,52 @@ +# git log-list-long + +## Show log list with our preferred options and long information + +Git alias: + +```git +log-list-long = log \ + --graph \ + --topo-order \ + --boundary \ + --decorate \ + --all \ + --date=iso8601-strict \ + --no-abbrev-commit \ + --abbrev=40 \ + --pretty=format:'␟%ad␟%h␟%s␟%cn <%ce>␟%G?' | \ + git name-rev --stdin --always --name-only | \ + awk 'BEGIN { FS="␟"; OFS="␟"; } { $4 = substr($4, 1, 50); print $0; }' | \ + column -s'␟' -t +``` + +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 commit format using abbreviated hexadecimal (not full hexadecimal) + + * Short author field using name (no email address) + + * 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 commit format using hash hexadecimal displayed as name-rev + + * Long author field using name and email address + + * Long layout with columns diff --git a/doc/git-log-list/index.md b/doc/git-log-list/index.md new file mode 100644 index 00000000..434e2d82 --- /dev/null +++ b/doc/git-log-list/index.md @@ -0,0 +1,48 @@ +# git log-list + +## Show log list with our preferred options and short information + +Git alias: + +```git +log-list = log \ + --graph \ + --topo-order \ + --decorate \ + --all \ + --boundary \ + --date=short \ + --abbrev-commit \ + --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' +``` + +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 commit format using abbreviated hexadecimal (not full hexadecimal) + + * Short author field using name (no email address) + + * 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 commit format using hash hexadecimal displayed as name-rev + + * Long author field using name and email address + + * Long layout with columns diff --git a/doc/git-log-my-day/index.md b/doc/git-log-my-day/index.md new file mode 100644 index 00000000..38b24c73 --- /dev/null +++ b/doc/git-log-my-day/index.md @@ -0,0 +1,39 @@ +# git log-my-day + +## Show log with my own recent day + +Git alias: + +```git +log-my-day = log --author $(git config user.email) --since=1-day-ago +``` + +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/index.md b/doc/git-log-my-hour/index.md new file mode 100644 index 00000000..972ac86c --- /dev/null +++ b/doc/git-log-my-hour/index.md @@ -0,0 +1,39 @@ +# git log-my-hour + +## Show log with my own recent hour + +Git alias: + +```git +log-my-hour = log --author $(git config user.email) --since=1-hour-ago +``` + +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/index.md b/doc/git-log-my-month/index.md new file mode 100644 index 00000000..dcf83a17 --- /dev/null +++ b/doc/git-log-my-month/index.md @@ -0,0 +1,39 @@ +# git log-my-month + +## Show log with my own recent month + +Git alias: + +```git +log-my-month = log --author $(git config user.email) --since=1-month-ago +``` + +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/index.md b/doc/git-log-my-week/index.md new file mode 100644 index 00000000..6a7b00af --- /dev/null +++ b/doc/git-log-my-week/index.md @@ -0,0 +1,39 @@ +# git log-my-week + +## Show log with my own recent week + +Git alias: + +```git +log-my-week = log --author $(git config user.email) --since=1-week-ago +``` + +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/index.md b/doc/git-log-my-year/index.md new file mode 100644 index 00000000..0a122af3 --- /dev/null +++ b/doc/git-log-my-year/index.md @@ -0,0 +1,39 @@ +# git log-my-year + +## Show log with my own recent year + +Git alias: + +```git +log-my-year = log --author $(git config user.email) --since=1-year-ago +``` + +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/index.md b/doc/git-log-my/index.md new file mode 100644 index 00000000..7b66db27 --- /dev/null +++ b/doc/git-log-my/index.md @@ -0,0 +1,15 @@ +# git log-my + +## Show log for my own commits by my own user email + +Git alias: + +```git +log-my = !git log --author $(git config user.email) +``` + +Example: + +```shell +git log-my +``` diff --git a/doc/git-log-of-count-and-day-of-week/index.md b/doc/git-log-of-count-and-day-of-week/index.md new file mode 100644 index 00000000..e30e661a --- /dev/null +++ b/doc/git-log-of-count-and-day-of-week/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-day-of-week + +## Show log with count and day of week + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-count-and-day/index.md new file mode 100644 index 00000000..4ca6c0b6 --- /dev/null +++ b/doc/git-log-of-count-and-day/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-day + +## Show log with count and day + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-count-and-email/index.md new file mode 100644 index 00000000..b7a45023 --- /dev/null +++ b/doc/git-log-of-count-and-email/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-email + +## Show log with count and email + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-count-and-format-with-date/index.md new file mode 100644 index 00000000..68b2e8e3 --- /dev/null +++ b/doc/git-log-of-count-and-format-with-date/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-format-with-date + +## Show log with count and custom format string with date + +Git alias: + +```git +git log-of-count-and-format-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/index.md b/doc/git-log-of-count-and-format/index.md new file mode 100644 index 00000000..2935ca53 --- /dev/null +++ b/doc/git-log-of-count-and-format/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-format + +## Show a count of log entries and a custom format string + +Git alias: + +```git +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-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/index.md b/doc/git-log-of-count-and-hour-of-day/index.md new file mode 100644 index 00000000..0b1c68ac --- /dev/null +++ b/doc/git-log-of-count-and-hour-of-day/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-hour-of-day + +## Show log with count and hour of day + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-count-and-hour/index.md new file mode 100644 index 00000000..fbda07e9 --- /dev/null +++ b/doc/git-log-of-count-and-hour/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-hour + +## Show log with count and hour + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-count-and-month/index.md new file mode 100644 index 00000000..6ff19f03 --- /dev/null +++ b/doc/git-log-of-count-and-month/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-month + +## Show log with count and month + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-count-and-week-of-year/index.md new file mode 100644 index 00000000..91808c0d --- /dev/null +++ b/doc/git-log-of-count-and-week-of-year/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-week-of-year + +## Show log with count and week of year + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-count-and-week/index.md new file mode 100644 index 00000000..12b1f50e --- /dev/null +++ b/doc/git-log-of-count-and-week/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-week + +## Show log with count and week + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-count-and-year/index.md new file mode 100644 index 00000000..443f242c --- /dev/null +++ b/doc/git-log-of-count-and-year/index.md @@ -0,0 +1,17 @@ +# git log-of-count-and-year + +## Show log with count and year + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-day-and-count/index.md new file mode 100644 index 00000000..31d59c8b --- /dev/null +++ b/doc/git-log-of-day-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-day-and-count + +## Show log with day and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-day-of-week-and-count/index.md new file mode 100644 index 00000000..30e71115 --- /dev/null +++ b/doc/git-log-of-day-of-week-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-day-of-week-and-count + +## Show log with day of week and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-email-and-count/index.md new file mode 100644 index 00000000..1ebd661d --- /dev/null +++ b/doc/git-log-of-email-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-email-and-count + +## Show log with email and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-format-and-count-with-date/index.md new file mode 100644 index 00000000..c991bd44 --- /dev/null +++ b/doc/git-log-of-format-and-count-with-date/index.md @@ -0,0 +1,17 @@ +# git log-of-format-and-count-with-date + +## Show log with a custom format string and a count and a date + +Git alias: + +```git +git log-of-format-and-count-with-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/index.md b/doc/git-log-of-format-and-count/index.md new file mode 100644 index 00000000..97294fcd --- /dev/null +++ b/doc/git-log-of-format-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-format-and-count + +## Show log with a custom format string and count + +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" +``` + +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/index.md b/doc/git-log-of-hour-and-count/index.md new file mode 100644 index 00000000..3e0b7603 --- /dev/null +++ b/doc/git-log-of-hour-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-hour-and-count + +## Show log with hour and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-hour-of-day-and-count/index.md new file mode 100644 index 00000000..81a5721f --- /dev/null +++ b/doc/git-log-of-hour-of-day-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-hour-of-day-and-count + +## Show log with hour of day and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-month-and-count/index.md new file mode 100644 index 00000000..18a1675b --- /dev/null +++ b/doc/git-log-of-month-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-month-and-count + +## Show log with month and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-week-and-count/index.md new file mode 100644 index 00000000..a28af971 --- /dev/null +++ b/doc/git-log-of-week-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-week-and-count + +## Show log with week and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-week-of-year-and-count/index.md new file mode 100644 index 00000000..86f704f8 --- /dev/null +++ b/doc/git-log-of-week-of-year-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-week-of-year-and-count + +## Show log with week of year and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of-year-and-count/index.md new file mode 100644 index 00000000..1af51ece --- /dev/null +++ b/doc/git-log-of-year-and-count/index.md @@ -0,0 +1,17 @@ +# git log-of-year-and-count + +## Show log with year and count + +Git alias: + +```git +git log-of-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/index.md b/doc/git-log-of/index.md new file mode 100644 index 00000000..3f8bc0bb --- /dev/null +++ b/doc/git-log-of/index.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/index.md b/doc/git-log-refs/index.md new file mode 100644 index 00000000..decc6acb --- /dev/null +++ b/doc/git-log-refs/index.md @@ -0,0 +1,15 @@ +# git log-refs + +## Show log with commits that are referred by some branch or tag + +Git alias: + +```git +log-refs = log --all --graph --decorate --oneline --simplify-by-decoration --no-merges +``` + +Example: + +```shell +git log-refs +``` diff --git a/doc/git-log-timeline/index.md b/doc/git-log-timeline/index.md new file mode 100644 index 00000000..32561f75 --- /dev/null +++ b/doc/git-log-timeline/index.md @@ -0,0 +1,3 @@ +# git log-timeline + +TODO diff --git a/doc/git-log/index.md b/doc/git-log/index.md new file mode 100644 index 00000000..681091fc --- /dev/null +++ b/doc/git-log/index.md @@ -0,0 +1,82 @@ +# git log + +## Log helpers + +Git alias: + +```git +# Show log in our preferred format for our key performance indicators. A.k.a. `ll`. +log-like = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' + +# Show log in our preferred format for our key performance indicators, with long items. A.k.a. `lll`. +log-like-long = log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%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-like +git log-like-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/index.md b/doc/git-lor/index.md new file mode 100644 index 00000000..9a96c257 --- /dev/null +++ b/doc/git-lor/index.md @@ -0,0 +1,15 @@ +# git lor + +## Log with one line per item, in reverse order i.e. recent items first + +Git alias: + +```git +lor = log --oneline --reverse +``` + +Example: + +```shell +git lor +``` diff --git a/doc/alias/git-lp/index.md b/doc/git-lp/index.md similarity index 68% rename from doc/alias/git-lp/index.md rename to doc/git-lp/index.md index d345f984..b8817946 100644 --- a/doc/alias/git-lp/index.md +++ b/doc/git-lp/index.md @@ -2,12 +2,14 @@ ## Log with patch generation -```gitconfig +Git alias: + +```git lp = log --patch ``` Example: -```sh -$ git lp +```shell +git lp ``` diff --git a/doc/alias/git-ls/index.md b/doc/git-ls/index.md similarity index 76% rename from doc/alias/git-ls/index.md rename to doc/git-ls/index.md index dd45e6a7..400b8b93 100644 --- a/doc/alias/git-ls/index.md +++ b/doc/git-ls/index.md @@ -2,12 +2,14 @@ ## List files in the index and the working tree; like Unix "ls" command -```gitconfig +Git alias: + +```git ls = ls-files ``` Example: -```sh -$ git ls +```shell +git ls ``` diff --git a/doc/alias/git-lsd/index.md b/doc/git-lsd/index.md similarity index 72% rename from doc/alias/git-lsd/index.md rename to doc/git-lsd/index.md index 9fd7689f..08897da3 100644 --- a/doc/alias/git-lsd/index.md +++ b/doc/git-lsd/index.md @@ -2,12 +2,14 @@ ## List files and show debug information -```gitconfig +Git alias: + +```git lsd = ls-files --debug ``` Example: -```sh -$ git lsd +```shell +git lsd ``` diff --git a/doc/alias/git-lsfn/index.md b/doc/git-lsfn/index.md similarity index 71% rename from doc/alias/git-lsfn/index.md rename to doc/git-lsfn/index.md index 6eec6c43..47541bd3 100644 --- a/doc/alias/git-lsfn/index.md +++ b/doc/git-lsfn/index.md @@ -2,12 +2,14 @@ ## List files and show full name -```gitconfig +Git alias: + +```git lsfn = ls-files --full-name ``` Example: -```sh -$ git lsfn +```shell +git lsfn ``` diff --git a/doc/alias/git-lsio/index.md b/doc/git-lsio/index.md similarity index 91% rename from doc/alias/git-lsio/index.md rename to doc/git-lsio/index.md index 4ac3f35a..ce71362b 100644 --- a/doc/alias/git-lsio/index.md +++ b/doc/git-lsio/index.md @@ -2,14 +2,16 @@ ## List files that git is ignoring -```gitconfig +Git alias: + +```git lsio = ls-files --ignored --others --exclude-standard ``` Example: -```sh -$ git lsio +```shell +git lsio ``` ### Documentation for `git ls-files` diff --git a/doc/alias/git-lto/index.md b/doc/git-lto/index.md similarity index 79% rename from doc/alias/git-lto/index.md rename to doc/git-lto/index.md index cd941e40..2ee27ad3 100644 --- a/doc/alias/git-lto/index.md +++ b/doc/git-lto/index.md @@ -2,15 +2,17 @@ ## Log with items appearing in topological order -```gitconfig -# git lto: +Git alias: + +```git +# git lto: lto = log --topo-order ``` Example: -```sh -$ git lto +```shell +git lto ``` Topological order means that descendant commits are shown before their parents. diff --git a/doc/git-m/index.md b/doc/git-m/index.md new file mode 100644 index 00000000..d3ccb0c5 --- /dev/null +++ b/doc/git-m/index.md @@ -0,0 +1,15 @@ +# git m + +## Short for "git merge" + +Git alias: + +```git +m = merge +``` + +Example: + +```shell +git m +``` diff --git a/doc/alias/git-ma/index.md b/doc/git-ma/index.md similarity index 72% rename from doc/alias/git-ma/index.md rename to doc/git-ma/index.md index 22d4821f..81658029 100644 --- a/doc/alias/git-ma/index.md +++ b/doc/git-ma/index.md @@ -2,12 +2,14 @@ ## Merge abort i.e. abort the merge process -```gitconfig +Git alias: + +```git ma = merge --abort ``` Example: -```sh -$ git ma +```shell +git ma ``` diff --git a/doc/git-mainly/index.md b/doc/git-mainly/index.md new file mode 100644 index 00000000..1d93087a --- /dev/null +++ b/doc/git-mainly/index.md @@ -0,0 +1,20 @@ +# git mainly + +## Make local like main + + +Git alias: + +```git +mainly = !git checkout main && git fetch origin --prune && git reset --hard origin/main +``` + +Example: + +```shell +git mainly +``` + +Do everything we can to make the local repo like the main branch. + +TODO: handle tags, and delete superfluous branches, and add error handling. diff --git a/doc/alias/git-mc/index.md b/doc/git-mc/index.md similarity index 74% rename from doc/alias/git-mc/index.md rename to doc/git-mc/index.md index aa886f39..12738431 100644 --- a/doc/alias/git-mc/index.md +++ b/doc/git-mc/index.md @@ -2,12 +2,14 @@ ## Merge continue i.e. continue the merge process -```gitconfig +Git alias: + +```git mc = merge --continue ``` Example: -```sh -$ git mc +```shell +git mc ``` diff --git a/doc/alias/git-merge-safe/index.md b/doc/git-merge-safe/index.md similarity index 78% rename from doc/alias/git-merge-safe/index.md rename to doc/git-merge-safe/index.md index 3c1c0f5e..ffc69555 100644 --- a/doc/alias/git-merge-safe/index.md +++ b/doc/git-merge-safe/index.md @@ -2,14 +2,16 @@ ## Join two or more development histories together safely -```gitconfig +Git alias: + +```git merge-safe = merge --no-commit --no-ff ``` Example: -```sh -$ git merge-safe +```shell +git merge-safe ``` ### Documentation for `git-merge` @@ -20,19 +22,19 @@ $ git merge-safe
Perform the merge and stop just before creating a merge commit, -to give the user a chance to inspect and further tweak the merge +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 +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 +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/index.md b/doc/git-merge-span-diff/index.md new file mode 100644 index 00000000..f93e91d3 --- /dev/null +++ b/doc/git-merge-span-diff/index.md @@ -0,0 +1,20 @@ +# git merge-span-diff + +## Show the changes that were introduced by a merge + +```gitalias +merge-span-diff = !"git diff `git merge-span ... $1`" +``` + +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/index.md b/doc/git-merge-span-difftool/index.md new file mode 100644 index 00000000..f5de0839 --- /dev/null +++ b/doc/git-merge-span-difftool/index.md @@ -0,0 +1,20 @@ +# git merge-span-difftool + +## Show the changes that were introduced by a merge, in your difftool + +```gitalias +merge-span-difftool = !"git difftool `git merge-span ... $1`" +``` + +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/index.md b/doc/git-merge-span-log/index.md new file mode 100644 index 00000000..3a4f6c54 --- /dev/null +++ b/doc/git-merge-span-log/index.md @@ -0,0 +1,22 @@ +# git merge-span-log + +## Find the commits that were introduced by a merge + +Git alias: + +```git +merge-span-log = "!git log `git merge-span .. $1`" +``` + +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/alias/git-merge-span/index.md b/doc/git-merge-span/index.md similarity index 68% rename from doc/alias/git-merge-span/index.md rename to doc/git-merge-span/index.md index 5b6ef5a3..9c137358 100644 --- a/doc/alias/git-merge-span/index.md +++ b/doc/git-merge-span/index.md @@ -1,8 +1,10 @@ -# git merge-span-* +# git merge-span ## Merge span aliases -```gitconfig +Git alias: + +```git # Given a merge commit, find the span of commits that exist(ed). # Not so useful in itself, but used by other aliases. # Thanks to Rob Miller for the merge-span-* aliases. @@ -23,9 +25,16 @@ merge-span-difftool = !"git difftool `git merge-span ... $1`" Example: -```sh -$ git merge-span -$ git merge-span-log -$ git merge-span-diff -$ git merge-span-difftool +```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/index.md b/doc/git-mncnf/index.md new file mode 100644 index 00000000..d5ccf18f --- /dev/null +++ b/doc/git-mncnf/index.md @@ -0,0 +1,17 @@ +# git mncnf + +## Merge with no autocommit, and with no fast-forward + +Git alias: + +```git +mncnf = merge --no-commit --no-ff +``` + +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/alias/git-move-alias/index.md b/doc/git-move-alias/index.md similarity index 92% rename from doc/alias/git-move-alias/index.md rename to doc/git-move-alias/index.md index 56bc58bf..acb16690 100644 --- a/doc/alias/git-move-alias/index.md +++ b/doc/git-move-alias/index.md @@ -2,7 +2,9 @@ ## Rename an existing git alias -```gitconfig +Git alias: + +```git move-alias = "!f() { \ if [ $# != 3 ]; then \ echo \"Usage: git move-alias ( --local | --global ) \"; \ @@ -32,7 +34,7 @@ move-alias = "!f() { \ Example: -```sh -$ git move-alias --local foo bar -$ git move-alias --global foo bar +```shell +git move-alias --local foo bar +git move-alias --global foo bar ``` diff --git a/doc/git-my-branch/index.md b/doc/git-my-branch/index.md new file mode 100644 index 00000000..456a88d4 --- /dev/null +++ b/doc/git-my-branch/index.md @@ -0,0 +1,22 @@ +# git current-branch + +## Get the current branch name + +Git alias: + +```git +current-branch = rev-parse --abbrev-ref HEAD +``` + +Example: + +```shell +git current-branch +main +``` + +Compare: + +* [git current-branch](../git-current-branch) - Get the current branch name (this alias) + +* [git upstream-branch](../git-upstream-branch) - Get the upstream branch name diff --git a/doc/git-o/index.md b/doc/git-o/index.md new file mode 100644 index 00000000..2f2e94cf --- /dev/null +++ b/doc/git-o/index.md @@ -0,0 +1,15 @@ +# git o + +## Short for "git checkout" + +Git alias: + +```git +o = checkout +``` + +Example: + +```shell +git o +``` diff --git a/doc/alias/git-optimizer/index.md b/doc/git-optimizer/index.md similarity index 68% rename from doc/alias/git-optimizer/index.md rename to doc/git-optimizer/index.md index 66fa3aa3..ae76ede5 100644 --- a/doc/alias/git-optimizer/index.md +++ b/doc/git-optimizer/index.md @@ -1,18 +1,20 @@ # git optimizer -## Optimize the repository +## Optimize a repo our preferred way i.e. by pruning and repacking -```gitconfig +Git alias: + +```git optimizer = !git pruner; git repacker; git prune-packed ``` Example: -```sh -$ git optimizer +```shell +git optimizer ``` -The purpose of this command is to do everything possible +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. @@ -20,7 +22,7 @@ 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/alias/git-orphans/index.md b/doc/git-orphans/index.md similarity index 73% rename from doc/alias/git-orphans/index.md rename to doc/git-orphans/index.md index d704db8a..a27fbb0c 100644 --- a/doc/alias/git-orphans/index.md +++ b/doc/git-orphans/index.md @@ -2,20 +2,22 @@ ## Find all objects that aren't referenced by any other object -```gitconfig +Git alias: + +```git orphans = fsck --full ``` Example: -```sh -$ git orphans +```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: -```sh -$ git branch foo -$ git merge foo +```shell +git branch foo +git merge foo ``` diff --git a/doc/alias/git-ours-git-theirs/index.md b/doc/git-ours-git-theirs/index.md similarity index 68% rename from doc/alias/git-ours-git-theirs/index.md rename to doc/git-ours-git-theirs/index.md index 6a153188..2659ab62 100644 --- a/doc/alias/git-ours-git-theirs/index.md +++ b/doc/git-ours-git-theirs/index.md @@ -2,16 +2,18 @@ ## Easy merging when you know which files you want -```gitconfig +Git alias: + +```git ours = !"f() { git checkout --ours $@ && git add $@; }; f" theirs = !"f() { git checkout --theirs $@ && git add $@; }; f" ``` Example: -```sh -$ git ours -$ git theirs +```shell +git ours +git theirs ``` Sometimes during a merge you want to take a file from one side wholesale. @@ -19,6 +21,8 @@ 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. - * ours: checkout our version of a file and add it +Compare: + +* [git ours](../git-ours) - Checkout our version of a file and add it - * theirs: checkout their 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/index.md b/doc/git-ours/index.md new file mode 100644 index 00000000..d414294c --- /dev/null +++ b/doc/git-ours/index.md @@ -0,0 +1,23 @@ +# git ours + +## Checkout our version of a file and add it + +Git alias: + +```git +ours = !"f() { git checkout --ours $@ && git add $@; }; f" +``` + +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/alias/git-outbound/index.md b/doc/git-outbound/index.md similarity index 65% rename from doc/alias/git-outbound/index.md rename to doc/git-outbound/index.md index 8c0e4e53..f0a00e1c 100644 --- a/doc/alias/git-outbound/index.md +++ b/doc/git-outbound/index.md @@ -1,14 +1,18 @@ # git outbound -```gitconfig +## Show outgoing changes compared to upstream + +Git alias: + +```git # git outbound - Show outgoing changes compared to upstream. outbound = log @{upstream}.. ``` Example: -```sh -$ git outbound +```shell +git outbound ``` Compare [git inbound](../git-inbound). diff --git a/doc/git-p/index.md b/doc/git-p/index.md new file mode 100644 index 00000000..e61148d6 --- /dev/null +++ b/doc/git-p/index.md @@ -0,0 +1,15 @@ +# git p + +## Short for "git pull" + +Git alias: + +```git +p = pull +``` + +Example: + +```shell +git p +``` diff --git a/doc/alias/git-panic/index.md b/doc/git-panic/index.md similarity index 82% rename from doc/alias/git-panic/index.md rename to doc/git-panic/index.md index 933d1602..770507ca 100644 --- a/doc/alias/git-panic/index.md +++ b/doc/git-panic/index.md @@ -2,14 +2,16 @@ ## When you're a little worried that the world is coming to an end -```gitconfig +Git alias: + +```git panic = !tar cvf ../panic.tar * ``` Example: -```sh -$ git panic +```shell +git panic ``` This alias creates an archive of the entire repo. diff --git a/doc/alias/git-pf/index.md b/doc/git-pf/index.md similarity index 75% rename from doc/alias/git-pf/index.md rename to doc/git-pf/index.md index 0f548c1e..870319e7 100644 --- a/doc/alias/git-pf/index.md +++ b/doc/git-pf/index.md @@ -1,14 +1,16 @@ # git pf -## Pull if a merge can be resolved as a fast-forward, otherwise fail. +## Pull if a merge can be resolved as a fast-forward, otherwise fail -```gitconfig +Git alias: + +```git # git pf: pf = pull --ff-only ``` Example: -```sh -$ git pf +```shell +git pf ``` diff --git a/doc/alias/git-pr/index.md b/doc/git-pr/index.md similarity index 79% rename from doc/alias/git-pr/index.md rename to doc/git-pr/index.md index 303e592c..ac8eebaa 100644 --- a/doc/alias/git-pr/index.md +++ b/doc/git-pr/index.md @@ -2,34 +2,36 @@ ## Pull with rebase i.e. provide a cleaner, linear, bisectable history -```gitconfig +Git alias: + +```git pr = pull --rebase ``` Example: -```sh -$ git pr +```shell +git pr ``` To automatically do "pull --rebase" everywhere: -```sh -$ git config --global pull.rebase true +```shell +git config --global pull.rebase true ``` -To automatically do "pull --rebase" for any branch based on +To automatically do "pull --rebase" for any branch based on the branch "main": -```sh -$ git config branch.main.rebase true +```shell +git config branch.main.rebase true ``` To automatically do "pull --rebase" for any newly-created branches: -```sh -$ git config --global branch.autosetuprebase always +```shell +git config --global branch.autosetuprebase always ``` To integrate changes between branches, you can merge or rebase. @@ -40,7 +42,7 @@ 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: -```sh +```shell 12345678 - Merge branch 'foo' of bar into main ``` diff --git a/doc/alias/git-pp/index.md b/doc/git-prp/index.md similarity index 96% rename from doc/alias/git-pp/index.md rename to doc/git-prp/index.md index b44d84fc..9ed423e6 100644 --- a/doc/alias/git-pp/index.md +++ b/doc/git-prp/index.md @@ -1,15 +1,17 @@ -# git pp +# git prp ## Pull with rebase preserve of merge commits -```gitconfig -pp = pull --rebase=preserve +Git alias: + +```git +prp = pull --rebase=preserve ``` Example: -```sh -$ git pp +```shell +git prp ``` See https://stackoverflow.com/questions/21364636/git-pull-rebase-preserve-merges diff --git a/doc/alias/git-pruner/index.md b/doc/git-pruner/index.md similarity index 73% rename from doc/alias/git-pruner/index.md rename to doc/git-pruner/index.md index e4162a6a..911b0abc 100644 --- a/doc/alias/git-pruner/index.md +++ b/doc/git-pruner/index.md @@ -1,15 +1,17 @@ # git pruner -## Prune everything that is unreachable now +## Prune using our recommnded way i.e. prune everything unreachable now -```gitconfig +Git alias: + +```git pruner = !"git prune --expire=now; git reflog expire --expire-unreachable=now --rewrite --all" ``` Example: -```sh -$ git pruner +```shell +git pruner ``` This command takes a long time to run, perhaps even overnight. diff --git a/doc/git-publish-git-unpublish/index.html b/doc/git-publish-git-unpublish/index.html new file mode 100644 index 00000000..193e83b0 --- /dev/null +++ b/doc/git-publish-git-unpublish/index.html @@ -0,0 +1,181 @@ + + + + + + git publish & git unpublish - GitAlias + + + + + + + + + + + + + + +
+
+

git publish & git unpublish

+

Publish/unpublish the current branch

+

Compare:

+ + +
+
+ +
+
+ +
+ GitAlias.com +
+
+
+ + + diff --git a/doc/git-publish-git-unpublish/index.md b/doc/git-publish-git-unpublish/index.md new file mode 100644 index 00000000..39f5f13c --- /dev/null +++ b/doc/git-publish-git-unpublish/index.md @@ -0,0 +1,9 @@ +# git publish & git unpublish + +## Publish/unpublish the current branch + +Compare: + +* [git publish](../git-publish) + +* [git unpublish](../git-unpublish) diff --git a/doc/git-publish/index.md b/doc/git-publish/index.md new file mode 100644 index 00000000..2b7ee5a4 --- /dev/null +++ b/doc/git-publish/index.md @@ -0,0 +1,26 @@ +# git publish + +## Publish the current branch + +Git alias: + +```git +publish = !"git push --set-upstream origin $(git 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/alias/git-pull1/index.md b/doc/git-pull1/index.md similarity index 61% rename from doc/alias/git-pull1/index.md rename to doc/git-pull1/index.md index f762e5f2..2989e1c8 100644 --- a/doc/alias/git-pull1/index.md +++ b/doc/git-pull1/index.md @@ -1,15 +1,17 @@ # git pull1 -## Pull just the current branch +## Pull just the one current branch -```gitconfig +Git alias: + +```git pull1 = "!git pull origin $(git current-branch)" ``` Example: -```sh -$ git pull1 +```shell +git pull1 ``` Compare [git push1](../git-push1). diff --git a/doc/alias/git-push1/index.md b/doc/git-push1/index.md similarity index 61% rename from doc/alias/git-push1/index.md rename to doc/git-push1/index.md index 40d0503c..4d074862 100644 --- a/doc/alias/git-push1/index.md +++ b/doc/git-push1/index.md @@ -1,15 +1,17 @@ # git push1 -## Push just the current branch +## Push just the one current branch -```gitconfig +Git alias: + +```git push1 = "!git push origin $(git current-branch)" ``` Example: -```sh -$ git push1 +```shell +git push1 ``` Compare [git pull1](../git-pull1). diff --git a/doc/git-pushy/index.md b/doc/git-pushy/index.md new file mode 100644 index 00000000..21f97151 --- /dev/null +++ b/doc/git-pushy/index.md @@ -0,0 +1,22 @@ +# git pushy + +## Push with force and lease + +Git alias: + +```git +pushy = !git push --force-with-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/index.md b/doc/git-put/index.md new file mode 100644 index 00000000..8c447634 --- /dev/null +++ b/doc/git-put/index.md @@ -0,0 +1,23 @@ +# git put + +## Put all changes for the current branch + +Git alias: + +```git +put = !git commit --all && git push +``` + +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/index.md b/doc/git-rb/index.md new file mode 100644 index 00000000..1484447d --- /dev/null +++ b/doc/git-rb/index.md @@ -0,0 +1,15 @@ +# git rb + +## Short for "git rebase" + +Git alias: + +```git +rb = rebase +``` + +Example: + +```shell +git rb +``` diff --git a/doc/alias/git-rba/index.md b/doc/git-rba/index.md similarity index 73% rename from doc/alias/git-rba/index.md rename to doc/git-rba/index.md index 3d317b69..624324e5 100644 --- a/doc/alias/git-rba/index.md +++ b/doc/git-rba/index.md @@ -2,12 +2,14 @@ ## Rebase abort i.e. abort the rebase process -```gitconfig +Git alias: + +```git rba = rebase --abort ``` Example: -```sh -$ git rba +```shell +git rba ``` diff --git a/doc/alias/git-rbc/index.md b/doc/git-rbc/index.md similarity index 84% rename from doc/alias/git-rbc/index.md rename to doc/git-rbc/index.md index 03a10331..eb975eb1 100644 --- a/doc/alias/git-rbc/index.md +++ b/doc/git-rbc/index.md @@ -2,15 +2,17 @@ ## Rebase continue i.e. continue the rebase process -```gitconfig +Git alias: + +```git # git rbc: rebase - resolution. rbc = rebase --continue ``` Example: -```sh -$ git rbc +```shell +git rbc ``` Continue after resolving a conflict and updating the index. diff --git a/doc/alias/git-rbi/index.md b/doc/git-rbi/index.md similarity index 70% rename from doc/alias/git-rbi/index.md rename to doc/git-rbi/index.md index 8fecfd8d..7d054b0a 100644 --- a/doc/alias/git-rbi/index.md +++ b/doc/git-rbi/index.md @@ -2,13 +2,15 @@ ## Rebase interactive i.e. do a rebase with prompts -```gitconfig -# git rbi: +Git alias: + +```git +# git rbi: rbi = rebase --interactive ``` Example: -```sh -$ git rbi +```shell +git rbi ``` diff --git a/doc/alias/git-rbiu/index.md b/doc/git-rbiu/index.md similarity index 85% rename from doc/alias/git-rbiu/index.md rename to doc/git-rbiu/index.md index 85905c89..8772ce31 100644 --- a/doc/alias/git-rbiu/index.md +++ b/doc/git-rbiu/index.md @@ -1,15 +1,17 @@ # git rbiu -## Rebase interactive on our unpushed commits. +## Rebase interactive on unpushed commits -```gitconfig +Git alias: + +```git rbiu = rebase --interactive @{upstream} ``` Example: -```sh -$ git rbiu +```shell +git rbiu ``` Before we push our local changes, we may want to do some cleanup, @@ -20,7 +22,7 @@ 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: -```sh +```shell pick 7f06d36 foo pick ad544d0 goo pick de3083a hoo @@ -29,11 +31,11 @@ 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 also edit "hoo" to rename it to "whatever". I make the file look like this: -```sh +```shell pick 7f06d36 foo s ad544d0 goo r de3083a whatever @@ -42,7 +44,7 @@ This gives me two new commit messages to edit, which I update. Now when I push the remote repo host receives two commits: -```sh +```shell 3400455 - foo 5dae0a0 - whatever ``` diff --git a/doc/alias/git-rbs/index.md b/doc/git-rbs/index.md similarity index 73% rename from doc/alias/git-rbs/index.md rename to doc/git-rbs/index.md index c0f55fe1..f58dea65 100644 --- a/doc/alias/git-rbs/index.md +++ b/doc/git-rbs/index.md @@ -2,13 +2,15 @@ ## Rebase skip i.e. restart the rebase process by skipping the current patch -```gitconfig -# git rbs: +Git alias: + +```git +# git rbs: rbs = rebase --skip ``` Example: -```sh -$ git rbs +```shell +git rbs ``` diff --git a/doc/git-rebase-branch/index.md b/doc/git-rebase-branch/index.md new file mode 100644 index 00000000..dec89ece --- /dev/null +++ b/doc/git-rebase-branch/index.md @@ -0,0 +1,15 @@ +# git rebase-branch + +## Interactively rebase all the commits on the current branch + +Git alias: + +```git +rebase-branch = !"git rebase --interactive `git merge-base main HEAD`" +``` + +Example: + +```shell +git rebase-branch +``` diff --git a/doc/alias/git-rebase-interactive-branch/index.md b/doc/git-rebase-interactive-branch/index.md similarity index 77% rename from doc/alias/git-rebase-interactive-branch/index.md rename to doc/git-rebase-interactive-branch/index.md index f27114b0..aad054b2 100644 --- a/doc/alias/git-rebase-interactive-branch/index.md +++ b/doc/git-rebase-interactive-branch/index.md @@ -2,12 +2,14 @@ ## Rebase interactive on all the commits on the current branch -```gitconfig +Git alias: + +```git rebase-interactive-branch = !"git rebase --interactive `git merge-base main HEAD`" ``` Example: -```sh -$ git rebase-interactive-branch +```shell +git rebase-interactive-branch ``` diff --git a/doc/git-rebase-recent/index.md b/doc/git-rebase-recent/index.md new file mode 100644 index 00000000..e2886d6b --- /dev/null +++ b/doc/git-rebase-recent/index.md @@ -0,0 +1,17 @@ +# git rebase-recent + +## Rebase recent commits with interactive + +Git alias: + +```git +rebase-recent = !git rebase --interactive $(git remote-ref) +``` + +Example: + +```shell +git rebase-recent +``` + +Thanks to jtolds on stackoverflow. diff --git a/doc/git-ref-recent/index.md b/doc/git-ref-recent/index.md new file mode 100644 index 00000000..e69de29b diff --git a/doc/alias/git-refs-by-date/index.md b/doc/git-refs-by-date/index.md similarity index 83% rename from doc/alias/git-refs-by-date/index.md rename to doc/git-refs-by-date/index.md index 9002aab0..9b4e84e8 100644 --- a/doc/alias/git-refs-by-date/index.md +++ b/doc/git-refs-by-date/index.md @@ -2,14 +2,16 @@ ## Show refs sorted by date for branches -```gitconfig +Git alias: + +```git refs-by-date = for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short)' ``` Example: -```sh -$ git refs-by-date +```shell +git refs-by-date ``` This alias can be useful for spring cleaning. diff --git a/doc/alias/git-reincarnate/index.md b/doc/git-reincarnate/index.md similarity index 92% rename from doc/alias/git-reincarnate/index.md rename to doc/git-reincarnate/index.md index 3b1a9e6b..20ef394c 100644 --- a/doc/alias/git-reincarnate/index.md +++ b/doc/git-reincarnate/index.md @@ -2,7 +2,9 @@ ## Delete a branch then create it anew -```gitconfig +Git alias: + +```git reincarnate = !"f() { \ [[ -n $@ ]] && \ git checkout \"$@\" && \ @@ -16,12 +18,12 @@ reincarnate = !"f() { \ Example: -```sh -$ git reincarnate +```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 +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, diff --git a/doc/git-remote-ref/index.md b/doc/git-remote-ref/index.md new file mode 100644 index 00000000..eb2f17b7 --- /dev/null +++ b/doc/git-remote-ref/index.md @@ -0,0 +1,23 @@ +# git remote-ref + +## TODO + +Git alias: + +```git +remote-ref = !"sh -c ' \ + 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'" +``` + +Example: + +```shell +git remote-ref +``` + +Thanks to jtolds on stackoverflow diff --git a/doc/alias/git-remotes-prune/index.md b/doc/git-remotes-prune/index.md similarity index 62% rename from doc/alias/git-remotes-prune/index.md rename to doc/git-remotes-prune/index.md index d82aa37d..b1237bd1 100644 --- a/doc/alias/git-remotes-prune/index.md +++ b/doc/git-remotes-prune/index.md @@ -1,18 +1,20 @@ # git remotes-prune -## For each remote branch, prune it. +## For each remote branch, prune it -```gitconfig +Git alias: + +```git remotes-prune = !git remote | xargs -n 1 git remote prune ``` Example: -```sh -$ git remotes-prune +```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`. +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/alias/git-remotes-push/index.md b/doc/git-remotes-push/index.md similarity index 54% rename from doc/alias/git-remotes-push/index.md rename to doc/git-remotes-push/index.md index eca2f2d7..9c9251d6 100644 --- a/doc/alias/git-remotes-push/index.md +++ b/doc/git-remotes-push/index.md @@ -1,13 +1,15 @@ # git remotes-push -## For each remote branch, push it. +## For each remote branch, push it -```gitconfig +Git alias: + +```git remotes-push = !git remote | xargs -I% -n1 git push % ``` Example: -```sh -$ git remotes-push +```shell +git remotes-push ``` diff --git a/doc/alias/git-repacker/index.md b/doc/git-repacker/index.md similarity index 90% rename from doc/alias/git-repacker/index.md rename to doc/git-repacker/index.md index 1475414f..54792eff 100644 --- a/doc/alias/git-repacker/index.md +++ b/doc/git-repacker/index.md @@ -1,15 +1,17 @@ # git repacker -## Repack a repo as recommended by Linus. +## Repack a repo using our recommended way i.e. as Linus Torvalds describes -```gitconfig +Git alias: + +```git repacker = repack -a -d -f --depth=300 --window=300 --window-memory=1g ``` Example: -```sh -$ git repacker +```shell +git repacker ``` This command takes a long time to run, perhaps even overnight. @@ -17,7 +19,7 @@ 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: -```sh +```shell git repack -a -d --depth=250 --window=250 ``` diff --git a/doc/git-reset-commit-hard-clean/index.md b/doc/git-reset-commit-hard-clean/index.md new file mode 100644 index 00000000..1fac5fc4 --- /dev/null +++ b/doc/git-reset-commit-hard-clean/index.md @@ -0,0 +1,20 @@ +# git reset-commit-hard-clean + +# Move backwards on the commit chain + +Git alias: + +```git +reset-commit-hard-clean = !git reset --hard HEAD~1 && git clean -df +``` + +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/index.md b/doc/git-reset-commit-hard/index.md new file mode 100644 index 00000000..1c1e9ac0 --- /dev/null +++ b/doc/git-reset-commit-hard/index.md @@ -0,0 +1,19 @@ +# git reset-commit-hard + +# Move backwards on the commit chain +Git alias: + +```git +reset-commit-hard = reset --hard HEAD~1 +``` + +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/index.md b/doc/git-reset-commit/index.md new file mode 100644 index 00000000..1c244990 --- /dev/null +++ b/doc/git-reset-commit/index.md @@ -0,0 +1,20 @@ +# git reset-commit + +# Move backwards on the commit chain + +Git alias: + +```git +reset-commit = reset --soft HEAD~1 +``` + +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-to-pristine/index.md b/doc/git-reset-to-pristine/index.md new file mode 100644 index 00000000..5141431b --- /dev/null +++ b/doc/git-reset-to-pristine/index.md @@ -0,0 +1,19 @@ +# git reset-to-pristine + +# Reset commits and clean all differences +Git alias: + +```git +reset-to-pristine = !git reset --hard && git clean -dffx +``` + +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/index.md b/doc/git-reset-to-upstream/index.md new file mode 100644 index 00000000..d31bfb0d --- /dev/null +++ b/doc/git-reset-to-upstream/index.md @@ -0,0 +1,20 @@ +# git reset-to-upstream + +# Reset commits back to the upstream branch + +Git alias: + +```git +reset-to-upstream = !git reset --hard $(git 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/alias/git-reset/index.md b/doc/git-reset/index.md similarity index 70% rename from doc/alias/git-reset/index.md rename to doc/git-reset/index.md index 9a56463e..f77e2881 100644 --- a/doc/alias/git-reset/index.md +++ b/doc/git-reset/index.md @@ -2,22 +2,24 @@ ## Move backwards on the commit chain -```gitconfig +Git alias: + +```git reset-commit = reset --soft HEAD~1 reset-commit-hard = reset --hard HEAD~1 -reset-commit-clean = !git reset --hard HEAD~1 && git clean -df +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: -```sh -$ git reset-commit -$ git reset-commit-hard -$ git reset-commit-clean -$ git reset-to-pristine -$ git reset-to-upstrea +```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. diff --git a/doc/alias/git-rev-list-all-objects-by-size-and-name/index.md b/doc/git-rev-list-all-objects-by-size-and-name/index.md similarity index 85% rename from doc/alias/git-rev-list-all-objects-by-size-and-name/index.md rename to doc/git-rev-list-all-objects-by-size-and-name/index.md index 6fd71cf0..d9d46ffb 100644 --- a/doc/alias/git-rev-list-all-objects-by-size-and-name/index.md +++ b/doc/git-rev-list-all-objects-by-size-and-name/index.md @@ -2,14 +2,16 @@ ## List all objects by size in bytes and file name. -```gitconfig +Git alias: + +```git rev-list-all-objects-by-size-and-name = !"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" ``` Example: -```sh -$ git rev-list-all-objects-by-size-and-name +```shell +git rev-list-all-objects-by-size-and-name ``` By [raphinesse](https://stackoverflow.com/users/380229/raphinesse) diff --git a/doc/alias/git-rev-list-all-objects-by-size/index.md b/doc/git-rev-list-all-objects-by-size/index.md similarity index 81% rename from doc/alias/git-rev-list-all-objects-by-size/index.md rename to doc/git-rev-list-all-objects-by-size/index.md index 8c9ca9df..741026b0 100644 --- a/doc/alias/git-rev-list-all-objects-by-size/index.md +++ b/doc/git-rev-list-all-objects-by-size/index.md @@ -2,14 +2,16 @@ ## List all blobs by size in bytes -```gitconfig +Git alias: + +```git rev-list-all-objects-by-size = !"git rev-list --all --objects | awk '{print $1}'| git cat-file --batch-check | fgrep blob | sort -k3nr" ``` Example: -```sh -$ git rev-list-all-objects-by-size +```shell +git rev-list-all-objects-by-size ``` By [CodeGnome](http://www.codegnome.com/) diff --git a/doc/alias/git-rl/index.md b/doc/git-rl/index.md similarity index 65% rename from doc/alias/git-rl/index.md rename to doc/git-rl/index.md index c90a596e..9a142abc 100644 --- a/doc/alias/git-rl/index.md +++ b/doc/git-rl/index.md @@ -1,15 +1,17 @@ # git rl -## Shortcut for "reflog" +## Short for "git reflog" -```gitconfig +Git alias: + +```git rl = reflog ``` Example: -```sh -$ git rl +```shell +git rl ``` Reflog is a reference log that manages when tips of branches are updated. diff --git a/doc/git-rr/index.md b/doc/git-rr/index.md new file mode 100644 index 00000000..376e9398 --- /dev/null +++ b/doc/git-rr/index.md @@ -0,0 +1,15 @@ +# git rr + +## Short for "git remote" + +Git alias: + +```git +rr = remote +``` + +Example: + +```shell +git rr +``` diff --git a/doc/alias/git-rrp/index.md b/doc/git-rrp/index.md similarity index 77% rename from doc/alias/git-rrp/index.md rename to doc/git-rrp/index.md index 5c98688e..0f8eac87 100644 --- a/doc/alias/git-rrp/index.md +++ b/doc/git-rrp/index.md @@ -2,12 +2,14 @@ ## Remote prune i.e. delete all stale remote-tracking branches under -```gitconfig +Git alias: + +```git rrp = remote prune ``` Example: -```sh -$ git rrp +```shell +git rrp ``` diff --git a/doc/alias/git-rrs/index.md b/doc/git-rrs/index.md similarity index 75% rename from doc/alias/git-rrs/index.md rename to doc/git-rrs/index.md index 83caf7f1..588fdb56 100644 --- a/doc/alias/git-rrs/index.md +++ b/doc/git-rrs/index.md @@ -2,12 +2,14 @@ ## Remote show i.e. give information about the remote -```gitconfig +Git alias: + +```git rrs = remote show ``` Example: -```sh -$ git rrs +```shell +git rrs ``` diff --git a/doc/alias/git-rru/index.md b/doc/git-rru/index.md similarity index 81% rename from doc/alias/git-rru/index.md rename to doc/git-rru/index.md index 67d93165..01baf07b 100644 --- a/doc/alias/git-rru/index.md +++ b/doc/git-rru/index.md @@ -2,12 +2,14 @@ ## remote update i.e. fetch updates for a named set of remotes in the repository as defined by remotes -```gitconfig +Git alias: + +```git rru = remote update ``` Example: -```sh -$ git rru +```shell +git rru ``` diff --git a/doc/alias/git-rv/index.md b/doc/git-rv/index.md similarity index 62% rename from doc/alias/git-rv/index.md rename to doc/git-rv/index.md index 09a91fa0..a256d6ab 100644 --- a/doc/alias/git-rv/index.md +++ b/doc/git-rv/index.md @@ -1,15 +1,17 @@ # git rv -## Shortcut for "revert" +## Short for "git revert" -```gitconfig +Git alias: + +```git rv = revert ``` Example: -```sh -$ git rv +```shell +git rv ``` Revert will undo the changes from some existing commits. diff --git a/doc/git-rvnc/index.md b/doc/git-rvnc/index.md new file mode 100644 index 00000000..c200b92a --- /dev/null +++ b/doc/git-rvnc/index.md @@ -0,0 +1,18 @@ +# git rvnc + +## Revert with no commit i.e. without autocommit + +Git alias: + +```git +rvnc = revert --no-commit +``` + +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-s/index.md b/doc/git-s/index.md new file mode 100644 index 00000000..66b898d3 --- /dev/null +++ b/doc/git-s/index.md @@ -0,0 +1,15 @@ +# git s + +## Short for "git status" + +Git alias: + +```git +s = status +``` + +Example: + +```shell +git s +``` diff --git a/doc/git-sb/index.md b/doc/git-sb/index.md new file mode 100644 index 00000000..bf49a010 --- /dev/null +++ b/doc/git-sb/index.md @@ -0,0 +1,15 @@ +# git sb + +## Short for "git show-branch" i.e. print a list of branches and their commits + +Git alias: + +```git +sb = show-branch +``` + +Example: + +```shell +git sb +``` diff --git a/doc/alias/git-sbdo/index.md b/doc/git-sbdo/index.md similarity index 66% rename from doc/alias/git-sbdo/index.md rename to doc/git-sbdo/index.md index 47b43084..39322896 100644 --- a/doc/alias/git-sbdo/index.md +++ b/doc/git-sbdo/index.md @@ -2,13 +2,15 @@ ## Show branch list with date order -```gitconfig -# git sbdo - +Git alias: + +```git +# git sbdo - sbdo = show-branch --date-order ``` Example: -```sh -$ git sbdo +```shell +git sbdo ``` diff --git a/doc/alias/git-sbto/index.md b/doc/git-sbto/index.md similarity index 74% rename from doc/alias/git-sbto/index.md rename to doc/git-sbto/index.md index 24af5865..e8a6dcc2 100644 --- a/doc/alias/git-sbto/index.md +++ b/doc/git-sbto/index.md @@ -2,12 +2,14 @@ ## Show branch list with topological order -```gitconfig +Git alias: + +```git sbdo = show-branch --topo-order ``` Example: -```sh -$ git sbto +```shell +git sbto ``` diff --git a/doc/alias/git-search-commits/index.md b/doc/git-search-commits/index.md similarity index 73% rename from doc/alias/git-search-commits/index.md rename to doc/git-search-commits/index.md index 2ecb9306..6d5bb80e 100644 --- a/doc/alias/git-search-commits/index.md +++ b/doc/git-search-commits/index.md @@ -2,7 +2,9 @@ ## Search for a given string in all patches and print commit messages -```gitconfig +Git alias: + +```git search-commits = !"f() { \ query=\"$1\"; \ shift; \ @@ -12,26 +14,26 @@ search-commits = !"f() { \ Example: -```sh -$ git search-commits +```shell +git search-commits ``` Example: search for any commit that adds or removes string "foobar": -```sh -$ git searchcommits foobar +```shell +git search-commits foobar ``` Example: search commits for string "foobar" in directory "src/lib": -```sh -$ git searchcommits foobar src/lib +```shell +git search-commits foobar src/lib ``` Example: search commits for "foobar", print full diff of commit with 1 line context: -```sh -$ git searchcommits foobar --pickaxe-all -U1 src/lib +```shell +git search-commits foobar --pickaxe-all -U1 src/lib ``` Posted by Mikko Rantalainen on StackOverflow. diff --git a/doc/alias/git-serve/index.md b/doc/git-serve/index.md similarity index 88% rename from doc/alias/git-serve/index.md rename to doc/git-serve/index.md index 7e320fb3..8953d444 100644 --- a/doc/alias/git-serve/index.md +++ b/doc/git-serve/index.md @@ -2,14 +2,16 @@ ## Serve the local directory by starting a git server daemon -```gitconfig +Git alias: + +```git serve = "-c daemon.receivepack=true daemon --base-path=. --export-all --reuseaddr --verbose" ``` Example: -```sh -$ git serve +```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-show-unreachable/index.md b/doc/git-show-unreachable/index.md new file mode 100644 index 00000000..f0c6d749 --- /dev/null +++ b/doc/git-show-unreachable/index.md @@ -0,0 +1,17 @@ +# git show-unreachable + +## Show logs of unreachable commits + +Git alias: + +```git +show-unreachable = !"git fsck --unreachable | grep commit | cut -d\" \" -f3 | xargs git log" +``` + +Example: + +```shell +git show-unreachable +``` + +This can be useful, for example, when recovering contents of dropped stashes or reset commits. diff --git a/doc/alias/git-sm/index.md b/doc/git-sm/index.md similarity index 70% rename from doc/alias/git-sm/index.md rename to doc/git-sm/index.md index 145f588b..3581e04f 100644 --- a/doc/alias/git-sm/index.md +++ b/doc/git-sm/index.md @@ -1,15 +1,17 @@ # git sm -## Shortcut for "submodule" +## Short for "git submodule" -```gitconfig +Git alias: + +```git sm = submodule ``` Example: -```sh -$ git sm +```shell +git sm ``` Submodule enables foreign repositories to be embedded within a dedicated subdirectory of the source tree. diff --git a/doc/alias/git-sma/index.md b/doc/git-sma/index.md similarity index 71% rename from doc/alias/git-sma/index.md rename to doc/git-sma/index.md index 4f96915c..79dd41e8 100644 --- a/doc/alias/git-sma/index.md +++ b/doc/git-sma/index.md @@ -2,12 +2,14 @@ ## Submodule add i.e. add a submodule to this repo -```gitconfig +Git alias: + +```git sma = submodule add ``` Example: -```sh -$ git sma foo +```shell +git sma foo ``` diff --git a/doc/alias/git-smi/index.md b/doc/git-smi/index.md similarity index 73% rename from doc/alias/git-smi/index.md rename to doc/git-smi/index.md index 66f3db8b..76f4bb13 100644 --- a/doc/alias/git-smi/index.md +++ b/doc/git-smi/index.md @@ -2,12 +2,14 @@ ## Submodule init i.e. initialize a submodule in this repo -```gitconfig +Git alias: + +```git smi = submodule init ``` Example: -```sh -$ git smi foo +```shell +git smi foo ``` diff --git a/doc/alias/git-sms/index.md b/doc/git-sms/index.md similarity index 73% rename from doc/alias/git-sms/index.md rename to doc/git-sms/index.md index 345fa93c..02820fda 100644 --- a/doc/alias/git-sms/index.md +++ b/doc/git-sms/index.md @@ -2,12 +2,14 @@ ## Submodule sync i.e. synchronize a submodule in this repo -```gitconfig +Git alias: + +```git sms = submodule sync ``` Example: -```sh -$ git sms foo +```shell +git sms foo ``` diff --git a/doc/alias/git-smu/index.md b/doc/git-smu/index.md similarity index 73% rename from doc/alias/git-smu/index.md rename to doc/git-smu/index.md index a6e02387..189215e3 100644 --- a/doc/alias/git-smu/index.md +++ b/doc/git-smu/index.md @@ -2,12 +2,14 @@ ## submodule update i.e. update a submodule in this repo -```gitconfig +Git alias: + +```git smu = submodule update ``` Example: -```sh -$ git smu foo +```shell +git smu foo ``` diff --git a/doc/alias/git-smui/index.md b/doc/git-smui/index.md similarity index 70% rename from doc/alias/git-smui/index.md rename to doc/git-smui/index.md index f86031cf..6718e3e1 100644 --- a/doc/alias/git-smui/index.md +++ b/doc/git-smui/index.md @@ -2,12 +2,14 @@ ## submodule update with initialize -```gitconfig +Git alias: + +```git smui = submodule update --init ``` Example: -```sh -$ git smui foo +```shell +git smui foo ``` diff --git a/doc/alias/git-smuir/index.md b/doc/git-smuir/index.md similarity index 81% rename from doc/alias/git-smuir/index.md rename to doc/git-smuir/index.md index 683dce3f..1320e2c6 100644 --- a/doc/alias/git-smuir/index.md +++ b/doc/git-smuir/index.md @@ -2,15 +2,17 @@ ## submodule update with initialize and recursive; this is useful to bring a submodule fully up to date. -```gitconfig -# git smuir: +Git alias: + +```git +# git smuir: smuir = submodule update --init --recursive ``` Example: -```sh -$ git smuir foo +```shell +git smuir foo ``` This can be useful to bring a submodule fully up to date. diff --git a/doc/alias/git-snapshot/index.md b/doc/git-snapshot/index.md similarity index 90% rename from doc/alias/git-snapshot/index.md rename to doc/git-snapshot/index.md index 21a9bca7..2975ded5 100644 --- a/doc/alias/git-snapshot/index.md +++ b/doc/git-snapshot/index.md @@ -2,14 +2,16 @@ ## Take a snapshot of your current working tree -```gitconfig +Git alias: + +```git snapshot = !git stash push --include-untracked --message \"snapshot: $(date)\" && git stash apply \"stash@{0}\" ``` Example: -```sh -$ git snapshot +```shell +git snapshot ``` Take a snapshot of your current working tree without removing changes. @@ -19,13 +21,13 @@ into a commit but daren't stray too far from now without a backup. Running this … -```sh -$ git snapshot +```shell +git snapshot ``` … creates this stash: -```sh +```shell stash@{0}: On feature/handy-git-tricks: snapshot: Mon Apr 8 12:39:06 BST 2013 ``` diff --git a/doc/alias/git-ss/index.md b/doc/git-ss/index.md similarity index 69% rename from doc/alias/git-ss/index.md rename to doc/git-ss/index.md index fad8c3dc..9567f02e 100644 --- a/doc/alias/git-ss/index.md +++ b/doc/git-ss/index.md @@ -2,12 +2,14 @@ ## status with short format -```gitconfig +Git alias: + +```git ss = status --short ``` Example: -```sh -$ git ss +```shell +git ss ``` diff --git a/doc/alias/git-ssb/index.md b/doc/git-ssb/index.md similarity index 74% rename from doc/alias/git-ssb/index.md rename to doc/git-ssb/index.md index 91f795e2..917c56e0 100644 --- a/doc/alias/git-ssb/index.md +++ b/doc/git-ssb/index.md @@ -2,12 +2,14 @@ ## status with short format and branch info -```gitconfig +Git alias: + +```git ssb = status --short --branch ``` Example: -```sh -$ git ssb +```shell +git ssb ``` diff --git a/doc/alias/git-stashes/index.md b/doc/git-stashes/index.md similarity index 80% rename from doc/alias/git-stashes/index.md rename to doc/git-stashes/index.md index 80c5b51f..f451cc77 100644 --- a/doc/alias/git-stashes/index.md +++ b/doc/git-stashes/index.md @@ -2,19 +2,21 @@ ## List stashes -```gitconfig +Git alias: + +```git stashes = stash list ``` Example: -```sh -$ git stashes +```shell +git stashes ``` This alias is because friendly wording is easier to remember. -Our friendly wording for plurals: +Our friendly wording for plurals: * [git aliases](../git-aliases) diff --git a/doc/git-submodule/index.md b/doc/git-submodule/index.md new file mode 100644 index 00000000..8ba106b3 --- /dev/null +++ b/doc/git-submodule/index.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/alias/git-summary/index.md b/doc/git-summary/index.md similarity index 65% rename from doc/alias/git-summary/index.md rename to doc/git-summary/index.md index 1dfbb6d1..7f3caf9a 100644 --- a/doc/alias/git-summary/index.md +++ b/doc/git-summary/index.md @@ -1,13 +1,16 @@ # git summary -## Show a helpful summary of some typical metrics +## Show a summary of some typical metrics -```gitconfig +Git alias: + +```git summary = "!f() { \ printf \"Summary of this branch...\n\"; \ printf \"%s\n\" $(git rev-parse --abbrev-ref HEAD); \ printf \"%s first commit timestamp\n\" $(git log --date-order --format=%cI | tail -1); \ - printf \"%s latest commit timestamp\n\" $(git log -1 --date-order --format=%cI); \ + printf \"%s last commit timestamp\n\" $(git log -1 --date-order --format=%cI); \ + printf \"\nSummary of counts...\n\"; \ printf \"%d commit count\n\" $(git rev-list --count HEAD); \ printf \"%d date count\n\" $(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\n\" $(git tag | wc -l); \ @@ -28,14 +31,52 @@ summary = "!f() { \ Example: -```sh -$ git summary +```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 - * Latest commit timestamp + * Last commit timestamp + +Summary of the counts: + * Commit count * Date count * Tag count @@ -50,6 +91,9 @@ Summary of the directory: * 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/index.md b/doc/git-svn-b/index.md new file mode 100644 index 00000000..662acf10 --- /dev/null +++ b/doc/git-svn-b/index.md @@ -0,0 +1,15 @@ +# git svn-b + +## Subversion branch + +Git alias: + +```git +svn-b = svn branch +``` + +Example: + +```shell +git svn-b +``` diff --git a/doc/git-svn-c/index.md b/doc/git-svn-c/index.md new file mode 100644 index 00000000..b9cca176 --- /dev/null +++ b/doc/git-svn-c/index.md @@ -0,0 +1,15 @@ +# git svn-c + +## Subversion commit + +Git alias: + +```git +svn-c = svn dcommit +``` + +Example: + +```shell +git svn-c +``` diff --git a/doc/git-svn-cp/index.md b/doc/git-svn-cp/index.md new file mode 100644 index 00000000..51bd4d6c --- /dev/null +++ b/doc/git-svn-cp/index.md @@ -0,0 +1,15 @@ +# git svn-cp + +## Subversion cherry pick + +Git alias: + +```git +svn-cp = !GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick --edit +``` + +Example: + +```shell +git svn-cp +``` diff --git a/doc/git-svn-m/index.md b/doc/git-svn-m/index.md new file mode 100644 index 00000000..134a499c --- /dev/null +++ b/doc/git-svn-m/index.md @@ -0,0 +1,15 @@ +# git svn-m + +## Subversion merge + +Git alias: + +```git +svn-m = merge --squash +``` + +Example: + +```shell +git svn-m +``` diff --git a/doc/alias/git-svn/index.md b/doc/git-svn/index.md similarity index 74% rename from doc/alias/git-svn/index.md rename to doc/git-svn/index.md index 3a457145..642572e2 100644 --- a/doc/alias/git-svn/index.md +++ b/doc/git-svn/index.md @@ -2,7 +2,9 @@ ## Subversion version control helpers -```gitconfig +Git alias: + +```git svn-b = svn branch svn-m = merge --squash svn-c = svn dcommit @@ -11,9 +13,9 @@ svn-cp = !GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick --edit Example: -```sh -$ git svn-b -$ git svn-m -$ git svn-c -$ git svn-cp +```shell +git svn-b +git svn-m +git svn-c +git svn-cp ``` diff --git a/doc/alias/git-tags/index.md b/doc/git-tags/index.md similarity index 81% rename from doc/alias/git-tags/index.md rename to doc/git-tags/index.md index 47fb392f..9cadf381 100644 --- a/doc/alias/git-tags/index.md +++ b/doc/git-tags/index.md @@ -2,19 +2,21 @@ ## List tags -```gitconfig +Git alias: + +```git tags = tag -n1 --list ``` Example: -```sh -$ git tags +```shell +git tags ``` This alias is because friendly wording is easier to remember. -Our friendly wording for plurals: +Our friendly wording for plurals: * [git aliases](../git-aliases) diff --git a/doc/git-theirs/index.md b/doc/git-theirs/index.md new file mode 100644 index 00000000..ccac79a8 --- /dev/null +++ b/doc/git-theirs/index.md @@ -0,0 +1,23 @@ +# git theirs + +## Checkout their version of a file and add it + +Git alias: + +```git +theirs = !"f() { git checkout --theirs $@ && git add $@; }; f" +``` + +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/alias/git-top-name/index.md b/doc/git-top/index.md similarity index 50% rename from doc/alias/git-top-name/index.md rename to doc/git-top/index.md index 8ada8e15..a360f347 100644 --- a/doc/alias/git-top-name/index.md +++ b/doc/git-top/index.md @@ -1,14 +1,16 @@ -# git top-name +# git top ## Get the top level directory name -```gitconfig -top-name = rev-parse --show-toplevel +Git alias: + +```git +top = rev-parse --show-toplevel ``` Example: -```sh -$ git top-name +```shell +git top /home/alice/projects/example ``` diff --git a/doc/alias/git-topic-branch/index.md b/doc/git-topic-base-branch/index.md similarity index 66% rename from doc/alias/git-topic-branch/index.md rename to doc/git-topic-base-branch/index.md index c780b406..52293a10 100644 --- a/doc/alias/git-topic-branch/index.md +++ b/doc/git-topic-base-branch/index.md @@ -1,22 +1,24 @@ -# git topic-branch +# git topic-base-branch ## Show the project base topic branch name -```gitconfig -topic-branch = "!git config --get init.topicBaseBranchName || git config --get init.defaultBranch" +Git alias: + +```git +topic-base-branch = "!git config --get init.topicBaseBranchName || git config --get init.defaultBranch" ``` Example: ``` -$ git topic-branch +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 +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, @@ -28,7 +30,7 @@ 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" +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. @@ -37,19 +39,19 @@ 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`: -```sh -$ git config --local init.topicBaseBranchName "foo" +```shell +git config --local init.topicBaseBranchName "foo" -$ git config --global init.topicBaseBranchName "foo" +git config --global init.topicBaseBranchName "foo" -$ git config --system init.topicBaseBranchName "foo" +git config --system init.topicBaseBranchName "foo" ``` Example: ``` -$ git config init.topicBaseBranchName "foo" -$ git topic-branch +git config init.topicBaseBranchName "foo" +git topic-base-branch foo ``` diff --git a/doc/alias/git-topic-start/index.md b/doc/git-topic-begin/index.md similarity index 77% rename from doc/alias/git-topic-start/index.md rename to doc/git-topic-begin/index.md index a37e4555..607680dc 100644 --- a/doc/alias/git-topic-start/index.md +++ b/doc/git-topic-begin/index.md @@ -1,11 +1,13 @@ -# git topic-start +# git topic-begin -## Begin a topic branch +## Start a new topic branch -```gitconfig -topic-start = "!f(){ \ +Git alias: + +```git +topic-begin = "!f(){ \ new_branch=\"$1\"; \ - old_branch=$(git topic-branch); \ + old_branch=$(git topic-base-branch); \ git checkout \"$old_branch\"; git pull; \ git checkout -b \"$new_branch\" \"$old_branch\"; \ git push --set-upstream origin \"$new_branch\"; \ @@ -14,8 +16,8 @@ topic-start = "!f(){ \ Example: -```sh -$ git topic-start add-feature-foo +```shell +git topic-begin add-feature-foo ``` Customize this alias as you like for your own workflow. @@ -27,7 +29,7 @@ Our workflow does these steps: 1. Update the base topic branch. - 2. Create a new topic branch based on 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. diff --git a/doc/alias/git-topic-stop/index.md b/doc/git-topic-end/index.md similarity index 83% rename from doc/alias/git-topic-stop/index.md rename to doc/git-topic-end/index.md index 3c64c01d..d80ff8cd 100644 --- a/doc/alias/git-topic-stop/index.md +++ b/doc/git-topic-end/index.md @@ -1,17 +1,19 @@ -# git topic-stop +# git topic-end -## End a topic branch +## Finish the current topic branch -```gitconfig -topic-stop = "!f(){ \ +Git alias: + +```git +topic-end = "!f(){ \ new_branch=$(git current-branch); \ - old_branch=$(git topic-branch); \ + old_branch=$(git topic-base-branch); \ if [ \"$new_branch\" = \"$old_branch\" ]; then \ - printf \"You are asking to do git topic-stop,\n\"; \ + printf \"You are asking to do git topic-end,\n\"; \ printf \"but you are not on a new topic branch;\n\"; \ printf \"you are on the base topic branch: $old_branch.\n\"; \ printf \"Please checkout the topic branch that you want,\n\"; \ - printf \"then retry the git topic-stop command.\n\"; \ + printf \"then retry the git topic-end command.\n\"; \ else \ git push; \ git checkout \"$old_branch\"; \ @@ -23,8 +25,8 @@ topic-stop = "!f(){ \ Example: -```sh -$ git topic-stop +```shell +git topic-end ``` Customize this alias as you like for your own workflow. @@ -50,6 +52,6 @@ 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 +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/alias/git-topic-move/index.md b/doc/git-topic-move/index.md similarity index 90% rename from doc/alias/git-topic-move/index.md rename to doc/git-topic-move/index.md index 6ceeb3ee..ff84f551 100644 --- a/doc/alias/git-topic-move/index.md +++ b/doc/git-topic-move/index.md @@ -2,7 +2,9 @@ ## Rename the current topic branch -```gitconfig +Git alias: + +```git topic-move = "!f(){ \ new_branch=\"$1\"; \ old_branch=$(git current-branch); \ @@ -13,8 +15,8 @@ topic-move = "!f(){ \ Example: -```sh -$ git topic-move foo +```shell +git topic-move foo ``` Customize this alias as you like for your own workflow. diff --git a/doc/alias/git-topic-sync/index.md b/doc/git-topic-sync/index.md similarity index 86% rename from doc/alias/git-topic-sync/index.md rename to doc/git-topic-sync/index.md index 6b99cadc..2cf63f03 100644 --- a/doc/alias/git-topic-sync/index.md +++ b/doc/git-topic-sync/index.md @@ -1,11 +1,13 @@ # git topic-sync -## Synchronize the topic branch by doing updates +## Synchronize the current topic branch by doing updates -```gitconfig +Git alias: + +```git topic-sync = "!f(){ \ new_branch=$(git current-branch); \ - old_branch=$(git topic-branch); \ + old_branch=$(git topic-base-branch); \ if [ \"$new_branch\" = \"$old_branch\" ]; then \ printf \"You are asking to do git topic-sync,\n\"; \ printf \"but you are not on a new topic branch;\n\"; \ @@ -21,8 +23,8 @@ topic-sync = "!f(){ \ Example: -```sh -$ git topic-sync +```shell +git topic-sync ``` Customize this alias as you like for your own workflow. diff --git a/doc/alias/git-topic/index.md b/doc/git-topic/index.md similarity index 57% rename from doc/alias/git-topic/index.md rename to doc/git-topic/index.md index 4ca2bd65..2b97ad45 100644 --- a/doc/alias/git-topic/index.md +++ b/doc/git-topic/index.md @@ -2,13 +2,13 @@ ## Topic branch aliases -* [topic-branch](topic-branch) +* [topic-base-branch](topic-base-branch) -* [topic-start](topic-start) +* [topic-begin](topic-begin) -* [topic-sync](topic-sync) +* [topic-end](topic-end) -* [topic-stop](topic-stop) +* [topic-sync](topic-sync) * [topic-move](topic-move) @@ -19,34 +19,34 @@ 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 base topic branch: +Show your project's topic base branch name: -```sh -$ git topic-branch +```shell +git topic-base-branch ``` -Start work on a new topic branch, which creates your branch: +Begin your topic work by creating a new topic branch: -```sh -$ git topic-start add-feature-foo +```shell +git topic-begin ``` -Do work, and optionally sync our changes, which pushes and pulls: +End your topic work by finishing your existing topic branch: -```sh -$ git topic-sync +```shell +git topic-end ``` -Stop work on a topic branch, which deletes your branch: +Optional: synchronize your topic work, which pushes and pulls: -```sh -$ git topic-stop +```shell +git topic-sync ``` -If you want to move your branch a.k.a. rename it: +Optional: move your topic branch name i.e. rename your topic branch: -```sh -$ git topic-move +```shell +git topic-move ``` Ideas for your own alias customizations: diff --git a/doc/alias/git-track-all-remote-branches/index.md b/doc/git-track-all-remote-branches/index.md similarity index 65% rename from doc/alias/git-track-all-remote-branches/index.md rename to doc/git-track-all-remote-branches/index.md index a7891ee9..21930af5 100644 --- a/doc/alias/git-track-all-remote-branches/index.md +++ b/doc/git-track-all-remote-branches/index.md @@ -1,8 +1,10 @@ -# git track-all-remote-branches +# git track-all-remote-branches ## Track all remote branches that aren't already being tracked -```gitconfig +Git alias: + +```git track-all-remote-branches = !"f() { \ git branch -r | \ grep -v ' -> ' | \ @@ -12,10 +14,10 @@ track-all-remote-branches = !"f() { \ Example: -```sh -$ git track-all-remote-branches +```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 +we welcome better code that works using more-specific git commands. diff --git a/doc/alias/git-track/index.md b/doc/git-track/index.md similarity index 75% rename from doc/alias/git-track/index.md rename to doc/git-track/index.md index e0e6adcc..aa85f025 100644 --- a/doc/alias/git-track/index.md +++ b/doc/git-track/index.md @@ -2,9 +2,11 @@ ## Start tracking a branch, with default parameters, and showing the command -```gitconfig +Git alias: + +```git track = "!f(){ \ - branch=$(git rev-parse --abbrev-ref HEAD); + branch=$(git rev-parse --abbrev-ref HEAD); cmd=\"git branch $branch -u ${1:-origin}/${2:-$branch}\"; \ echo $cmd; \ $cmd; \ @@ -13,8 +15,8 @@ track = "!f(){ \ Example: -```sh -$ git track +```shell +git track ``` Compare [git untrack](../git-untrack). diff --git a/doc/alias/git-unadd/index.md b/doc/git-unadd/index.md similarity index 70% rename from doc/alias/git-unadd/index.md rename to doc/git-unadd/index.md index 0a9be0a6..ca70e732 100644 --- a/doc/alias/git-unadd/index.md +++ b/doc/git-unadd/index.md @@ -2,12 +2,14 @@ ## Reset something that's been added -```gitconfig +Git alias: + +```git unadd = reset HEAD ``` Example: -```sh -$ git unadd +```shell +git unadd ``` diff --git a/doc/git-unassume-all/index.md b/doc/git-unassume-all/index.md new file mode 100644 index 00000000..fe7a053c --- /dev/null +++ b/doc/git-unassume-all/index.md @@ -0,0 +1,17 @@ +# git unassume + +## Unassume all files + +Git alias: + +```git +unassume-all = "!git assumed | xargs git update-index --no-assume-unchanged" +``` + +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/index.md b/doc/git-unassume/index.md new file mode 100644 index 00000000..93801f71 --- /dev/null +++ b/doc/git-unassume/index.md @@ -0,0 +1,17 @@ +# git unassume + +## Unassume files + +Git alias: + +```git +unassume = update-index --no-assume-unchanged +``` + +Example: + +```shell +git unassumed +``` + +To see how this works, see [git assume-* & git unassume-*](../git-assume-and-git-unassume) diff --git a/doc/alias/git-uncommit/index.md b/doc/git-uncommit/index.md similarity index 67% rename from doc/alias/git-uncommit/index.md rename to doc/git-uncommit/index.md index 470faad8..a96172c0 100644 --- a/doc/alias/git-uncommit/index.md +++ b/doc/git-uncommit/index.md @@ -2,12 +2,14 @@ ## Reset one commit -```gitconfig +Git alias: + +```git uncommit = reset --soft HEAD~1 ``` Example: -```sh -$ git uncommit +```shell +git uncommit ``` diff --git a/doc/git-undo-commit-hard-clean/index.md b/doc/git-undo-commit-hard-clean/index.md new file mode 100644 index 00000000..2b4211a5 --- /dev/null +++ b/doc/git-undo-commit-hard-clean/index.md @@ -0,0 +1,20 @@ +# git undo-commit-hard-clean + +## Undo a commit with a hard reset and a clean + +Git alias: + +```git +undo-commit-hard-clean = !git reset --hard HEAD~1 && git clean -df +``` + +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/index.md b/doc/git-undo-commit-hard/index.md new file mode 100644 index 00000000..48c61b72 --- /dev/null +++ b/doc/git-undo-commit-hard/index.md @@ -0,0 +1,20 @@ +# git undo-commit-hard + +## Undo a commit with a hard reset + +Git alias: + +```git +undo-commit-hard = reset --hard HEAD~1 +``` + +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/index.md b/doc/git-undo-commit/index.md new file mode 100644 index 00000000..e4730da2 --- /dev/null +++ b/doc/git-undo-commit/index.md @@ -0,0 +1,20 @@ +# git undo-commit + +## Undo a commit with a soft reset + +Git alias: + +```git +undo-commit = reset --soft HEAD~1 +``` + +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-to-pristine/index.md b/doc/git-undo-to-pristine/index.md new file mode 100644 index 00000000..f463d576 --- /dev/null +++ b/doc/git-undo-to-pristine/index.md @@ -0,0 +1,20 @@ +# git undo-to-pristine + +## Undo commits and clean all differences + +Git alias: + +```git +undo-to-pristine = !git reset --hard && git clean -dffx +``` + +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/index.md b/doc/git-undo-to-upstream/index.md new file mode 100644 index 00000000..c99f3a32 --- /dev/null +++ b/doc/git-undo-to-upstream/index.md @@ -0,0 +1,19 @@ +# git undo-to-upstream + +# Undo commits back to the upstream branch +Git alias: + +```git +undo-to-upstream = !git reset --hard $(git 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/alias/git-undo/index.md b/doc/git-undo/index.md similarity index 65% rename from doc/alias/git-undo/index.md rename to doc/git-undo/index.md index 7f2d51f0..c6edc559 100644 --- a/doc/alias/git-undo/index.md +++ b/doc/git-undo/index.md @@ -1,23 +1,25 @@ # git undo-* -# Move backwards on the commit chain +## Move backwards on the commit chain -```gitconfig +Git alias: + +```git undo-commit = reset --soft HEAD~1 undo-commit-hard = reset --hard HEAD~1 -undo-commit-clean = !git reset --hard HEAD~1 && git clean -df +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: -```sh -$ git undo-commit -$ git undo-commit-hard -$ git undo-commit-clean -$ git undo-to-pristine -$ git undo-to-upstream +```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. diff --git a/doc/git-unpublish/index.md b/doc/git-unpublish/index.md new file mode 100644 index 00000000..2b09cb74 --- /dev/null +++ b/doc/git-unpublish/index.md @@ -0,0 +1,26 @@ +# git unpublish + +## Unpublish the current branch + +Git alias: + +```git +unpublish = !"git push origin :$(git 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/alias/git-untrack/index.md b/doc/git-untrack/index.md similarity index 67% rename from doc/alias/git-untrack/index.md rename to doc/git-untrack/index.md index 1dc2e53c..42fc6425 100644 --- a/doc/alias/git-untrack/index.md +++ b/doc/git-untrack/index.md @@ -1,8 +1,10 @@ # git untrack -## Stop tracking a branch, with default parameters, and showing the command. +## Stop tracking a branch, with default parameters, and show the command -```gitconfig +Git alias: + +```git untrack = "!f(){ \ branch=$(git rev-parse --abbrev-ref HEAD); \ cmd=\"git branch --unset-upstream ${1:-$branch}\"; \ @@ -13,8 +15,8 @@ untrack = "!f(){ \ Example: -```sh -$ git untrack +```shell +git untrack ``` Compare [git track](../git-track). diff --git a/doc/git-unwip/index.md b/doc/git-unwip/index.md new file mode 100644 index 00000000..615a3d41 --- /dev/null +++ b/doc/git-unwip/index.md @@ -0,0 +1,23 @@ +# git unwip + +## Alias for uncommit "work in progress" + +Git alias: + +```git +unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1" +``` + +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/index.md b/doc/git-upstream-branch/index.md new file mode 100644 index 00000000..12774fb1 --- /dev/null +++ b/doc/git-upstream-branch/index.md @@ -0,0 +1,22 @@ +# git upstream-branch + +## Get the upstream branch name + +Git alias: + +```git +upstream-branch = !git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD) +``` + +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/alias/git-w/index.md b/doc/git-w/index.md similarity index 51% rename from doc/alias/git-w/index.md rename to doc/git-w/index.md index 35e1c756..91f95229 100644 --- a/doc/alias/git-w/index.md +++ b/doc/git-w/index.md @@ -1,6 +1,6 @@ # git w -## Shortcut for "whatchanged" +## Short for "git whatchanged" ``` w = whatchanged @@ -8,6 +8,6 @@ w = whatchanged Example: -```sh -$ git w +```shell +git w ``` diff --git a/doc/alias/git-whatis/index.md b/doc/git-whatis/index.md similarity index 79% rename from doc/alias/git-whatis/index.md rename to doc/git-whatis/index.md index 9552203e..2fd6de23 100644 --- a/doc/alias/git-whatis/index.md +++ b/doc/git-whatis/index.md @@ -2,12 +2,14 @@ ## Given a git object, try to show it briefly -```gitconfig +Git alias: + +```git whatis = show --no-patch --pretty='tformat:%h (%s, %ad)' --date=short ``` Example: -```sh -$ git whatis +```shell +git whatis ``` diff --git a/doc/alias/git-who/index.md b/doc/git-who/index.md similarity index 81% rename from doc/alias/git-who/index.md rename to doc/git-who/index.md index d64acda5..3f7f2a98 100644 --- a/doc/alias/git-who/index.md +++ b/doc/git-who/index.md @@ -2,12 +2,14 @@ ## Show a short log of who has contributed commits, in descending order -```gitconfig +Git alias: + +```git who = shortlog --summary --email --numbered --no-merges ``` Example: -```sh -$ git who +```shell +git who ``` diff --git a/doc/alias/git-whois/index.md b/doc/git-whois/index.md similarity index 81% rename from doc/alias/git-whois/index.md rename to doc/git-whois/index.md index d30c1ee7..f7f2dd17 100644 --- a/doc/alias/git-whois/index.md +++ b/doc/git-whois/index.md @@ -1,14 +1,16 @@ # git whois -## Given a string for an author, try to figure out full name and email. +## Given a string for an author, try to figure out full name and email -```gitconfig +Git alias: + +```git whois = "!sh -c 'git log --regexp-ignore-case -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -" ``` Example: -```sh -$ git whois alice +```shell +git whois alice Alice Adams ``` diff --git a/doc/alias/git-wip-git-unwip/index.md b/doc/git-wip-git-unwip/index.md similarity index 84% rename from doc/alias/git-wip-git-unwip/index.md rename to doc/git-wip-git-unwip/index.md index f1f3c5e1..ba1e42b5 100644 --- a/doc/alias/git-wip-git-unwip/index.md +++ b/doc/git-wip-git-unwip/index.md @@ -1,12 +1,22 @@ # git wip & git unwip -## Helpers for "work in progress" +## 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: -```sh -$ git wip -$ git unwip +```shell +git wip + +git unwip ``` The wip alias is a quick way to add all new and modified files to the index, @@ -18,15 +28,3 @@ The unwip alias is a quick way to restore deleted files to the working tree. From https://gist.github.com/492227 and VonC on stackoverflow. -```gitconfig -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: - -```sh -$ git wip -$ git unwip -``` diff --git a/doc/git-wip/index.md b/doc/git-wip/index.md new file mode 100644 index 00000000..c9420386 --- /dev/null +++ b/doc/git-wip/index.md @@ -0,0 +1,23 @@ +# git wip + +## Alias for commit "work in progress" + +Git alias: + +```git +wip = !"git add --all; git ls-files --deleted -z | xargs -0 git rm; git commit --message=wip" +``` + +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/doc/hew-remote-dry-run/index.md b/doc/hew-remote-dry-run/index.md new file mode 100644 index 00000000..1c836208 --- /dev/null +++ b/doc/hew-remote-dry-run/index.md @@ -0,0 +1,51 @@ +# git hew-remote-dry-run + +## Delete remote branches that have been merged into an upstream commit (dry run) + +Git alias: + +```git +hew-remote-dry-run = !"f() { \ + commit=${1:-$(git upstream-branch)}; \ + git branch --remotes --merged \"$commit\" | \ + grep -v \"^[[:space:]]*origin/$commit$\" | \ + sed 's#[[:space:]]*origin/##' ; \ +}; f \"$@\"" +``` + +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/index.html b/doc/index.html new file mode 100644 index 00000000..243474c6 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,695 @@ + + + + + + GitAlias - GitAlias + + + + + + + + +
+

GitAlias

+

This project provides many git alias commands that you can use as you like.

+

Contents:

+ +

What is GitAlias?

+

GitAlias is a collection of git version control alias settings:

+ +

Use GitAlias because it makes your work faster, more streamlined, and more powerful.

+

Download, install, customize

+ +

You can also follow us on GitHub:

+ +

Short aliases

+

Short aliases are for frequent commands and options:

+

git add:

+ +

git branch:

+
    +
  • git b = branch
  • +
  • git bm = branch –merged
  • +
  • git bnm = branch –no-merged
  • +
  • git bed = branch –edit-description
  • +
  • git bsd = branch –show-description (polyfill)
  • +
+

git commit:

+ +

git checkout:

+ +

git cherry-pick:

+
    +
  • git cp = cherry-pick
  • +
  • git cpa = cherry-pick –abort
  • +
  • git cpc = cherry-pick –continue
  • +
  • git cpn = cherry-pick -n (–no-commit)
  • +
  • git cpnx = cherry-pick -n -x (–no-commit and with a message)
  • +
+

git diff:

+ +

git fetch:

+ +

git grep:

+
    +
  • git g = grep
  • +
  • git gg = grep with our preferred settings
  • +
  • git gn = grep -n (–line-number)
  • +
+

git log:

+
    +
  • git l = log
  • +
  • git ll = log list with our preferred short settings
  • +
  • git lll = log list with our preferred long settings
  • +
  • git lg = log –graph
  • +
  • git lo = log –oneline
  • +
  • git lor = log –oneline –reverse
  • +
  • git lp = log –patch
  • +
  • git lfp = log –first-parent
  • +
  • git lto = log –topo-order
  • +
+

git ls-files:

+
    +
  • git ls = ls-files
  • +
  • git lsd = ls-files –debug
  • +
  • git lsfn = ls-files –full-name
  • +
  • git lsio = ls-files –ignored –others –exclude-standard
  • +
+

git merge:

+ +

git pull:

+ +

git rebase:

+ +

git reflog:

+ +

git remote:

+ +

git revert:

+ +

git show-branch:

+ +

git submodule:

+ +

git status:

+ +

git whatchanged:

+ +

Friendly aliases

+

Start:

+
    +
  • git init-empty - Initialize a repo with an empty rebaseable commit
  • +
  • git cloner - Clone a repo and recurse on any of its submodules
  • +
+

Branch names:

+ +

Branch commits:

+ +

List items:

+ +

Undo:

+ +

Convenience alaises

+

Logging & reporting:

+ +

Lookups:

+
    +
  • git whois - Try to figure out an author’s information
  • +
  • git whatis - Try to figure out an object’s information
  • +
+

Commit details:

+ +

Add all & edit all:

+ +

Alias helpers:

+ +

Script helpers:

+
    +
  • git top - Get the top level directory name
  • +
  • git exec - Execute a shell script
  • +
+

Remotes:

+ +

Misc:

+ +

Advanced aliases:

+ +

Workflow aliases

+

Starting:

+ +

Save:

+
    +
  • git archive - Create an archive file of everything in the repo
  • +
  • git snapshot - Stash a snapshot of your current working tree
  • +
  • git panic - When you’re worried the world is coming to an end
  • +
+

Flow aliases:

+ +

reset & undo:

+
    +
  • git reset-* - Move backwards on the commit chain; synonym for undo-*
  • +
  • git undo-* - Move backwards on the commit chain; synonym for reset-*
  • +
+

track & untrack:

+
    +
  • git track - Start tracking from a local branch to upstream branch
  • +
  • git untrack - Stop tracking from a local branch to upstream branch
  • +
+

inbound & outbound:

+
    +
  • git inbound - Show incoming changes compared to upstream
  • +
  • git outbound - Show outgoing changes compared to upstream
  • +
+

pull1 & push1:

+
    +
  • git pull1 - Pull just the one current branch
  • +
  • git push1 - Push just the one current branch
  • +
+

Cull:

+ +

Topic branches a.k.a. feature branches:

+ +

Maintenance tuning:

+ +

Misc:

+ +

Tooling aliases

+

Use gitk:

+ +

Use other version control systems:

+ +

Use graphviz:

+ +

Index of all aliases

+ +

Tracking

+
    +
  • Package: gitalias
  • +
  • Version: 27.0.0
  • +
  • Created: 2016-06-17T22:05:43Z
  • +
  • Updated: 2022-01-09T19:00:32Z
  • +
  • License: GPL-2.0-or-later or contact us for custom license
  • +
  • Contact: Joel Parker Henderson (joel@joelparkerhenderson.com)
  • +
+ +
+ + + + + diff --git a/doc/index.md b/doc/index.md new file mode 100644 index 00000000..3167bba0 --- /dev/null +++ b/doc/index.md @@ -0,0 +1,663 @@ +# GitAlias + +This project provides many git alias commands that you can use as you like. + +Contents: + + * [What is GitAlias?](#what-is-git-alias) + * [Download, install, customize](#download-install-customize) + * [Follow us](#follow-us) + * [Short aliases](#short-aliases) + * [Friendly aliases](#friendly-aliases) + * [Convenience alaises](#convenience-alaises) + * [Workflow aliases](#workflow-aliases) + * [Tooling aliases](#tooling-aliases) + * [Index of all aliases](#index-of-all-aliases) + * [Contribute](CONTRIBUTING.md) + * [Changes](changes/index.md) + * [More ideas](more/index.md) + * [To do](todo/index.md) + * [Thanks](thanks/index.md) + * [Tracking](#tracking) + + +## What is GitAlias? + +GitAlias is a collection of git version control alias settings that can help you work faster and better. GitAlias provides short aliases such as [`s`](git-s/index.md) for status, command aliases such as [`chart`](git-chart/index.md) and [`churn`](git-churn/index.md), lookup aliases such as [`whois`](git-who/index.md) and [`whatis`](git-whatis/index.md), workflow aliases such as [`topic-begin`](git-topic-begin/index.md) for feature branch development, and more. + + +## Download, install, customize + +You can use GitAlias various ways: + + * Download GitAlias code in one file: [gitalias.txt](../gitalias.txt) + + * Install GitAlias using a variety of ways: [install guide](install/index.md). + + * Customize the aliases as you wish: [customize guide](customize/index.md). + + +## Follow us + +You can follow us on GitHub: + + * GitAlias account: [https://github.com/gitalias](https://github.com/gitalias) + + * GitAlias repository: [https://github.com/gitalias/gitalias](https://github.com/gitalias/gitalias) + + +## Short aliases + +Short aliases are for frequent commands and options: + +git add: + + * [git a](git-a/index.md) = add + * [git aa](git-aa/index.md) = add --all + * [git ap](git-ap/index.md) = add --patch + * [git au](git-au/index.md) = add --update + +git branch: + + * [git b](git-b/index.md) = branch + * [git bm](git-bm/index.md) = branch --merged + * [git bnm](git-bnm/index.md) = branch --no-merged + * [git bed](git-bed/index.md) = branch --edit-description + * [git bsd](git-bsd/index.md) = branch --show-description (polyfill) + +git commit: + + * [git c](git-c/index.md) = commit + * [git ca](git-ca/index.md) = commit --amend + * [git cam](git-cam/index.md) = commit --amend --message + * [git cane](git-cane/index.md) = commit --amend --no-edit + * [git ci](git-ci/index.md) = commit --interactive + * [git cm](git-cm/index.md) = commit --message + +git checkout: + + * [git co](git-co/index.md) = checkout + * [git cog](git-cog/index.md) = checkout --guess + * [git cong](git-cong/index.md) = checkout --no-guess + +git cherry-pick: + + * [git cp](git-cp/index.md) = cherry-pick + * [git cpa](git-cpa/index.md) = cherry-pick --abort + * [git cpc](git-cpc/index.md) = cherry-pick --continue + * [git cpn](git-cpn/index.md) = cherry-pick -n (--no-commit) + * [git cpnx](git-cpnx/index.md) = cherry-pick -n -x (--no-commit and with a message) + +git diff: + + * [git d](git-d/index.md) = diff + * [git dd](git-dd/index.md) = diff with our preferred settings + * [git dc](git-dc/index.md) = diff --cached + * [git ds](git-ds/index.md) = diff --staged + * [git dwd](git-dwd/index.md) = diff --word-diff + +git fetch: + + * [git f](git-f/index.md) = fetch + +git grep: + + * [git g](git-g/index.md) = grep + * [git gg](git-gg/index.md) = grep with our preferred settings + * [git gn](git-gn/index.md) = grep -n (--line-number) + +git log: + + * [git l](git-l/index.md) = log + * [git ll](git-ll/index.md) = log list with our preferred short settings + * [git lll](git-lll/index.md) = log list with our preferred long settings + * [git lg](git-lg/index.md) = log --graph + * [git lo](git-lo/index.md) = log --oneline + * [git lor](git-lor/index.md) = log --oneline --reverse + * [git lp](git-lp/index.md) = log --patch + * [git lfp](git-lfp/index.md) = log --first-parent + * [git lto](git-lto/index.md) = log --topo-order + +git ls-files: + + * [git ls](git-ls/index.md) = ls-files + * [git lsd](git-lsd/index.md) = ls-files --debug + * [git lsfn](git-lsfn/index.md) = ls-files --full-name + * [git lsio](git-lsio/index.md) = ls-files --ignored --others --exclude-standard + +git merge: + + * [git m](git-m/index.md) = merge + * [git ma](git-ma/index.md) = merge --abort + * [git mc](git-mc/index.md) = merge --continue + * [git mncnf](git-mncnf/index.md) = merge --no-commit --no-ff + +git pull: + + * [git pf](git-pf/index.md) = pull --ff-only + * [git pr](git-pr/index.md) = pull --rebase + * [git prp](git-prp/index.md) = pull --rebase=preserve + +git rebase: + + * [git rb](git-rb/index.md) = rebase + * [git rba](git-rb/index.md) = rebase --abort + * [git rbc](git-rbc/index.md) = rebase --continue + * [git rbs](git-rbs/index.md) = rebase --skip + * [git rbi](git-rbi/index.md) = rebase --interactive + * [git rbiu](git-rbiu/index.md) = rebase --interactive @{upstream} + +git reflog: + + * [git rl](git-rl/index.md) = reflog + +git remote: + + * [git rr](git-rr/index.md) = remote + * [git rrs](git-rrs/index.md) = remote show + * [git rru](git-rru/index.md) = remote update + * [git rrp](git-rrp/index.md) = remote prune + +git revert: + + * [git rv](git-rv/index.md) = revert + * [git rvnc](git-rvnc/index.md) = revert --no-commit + +git show-branch: + + * [git sb](git-sb/index.md) = show-branch + * [git sbdo](git-sbdo/index.md) = show-branch --date-order + * [git sbto](git-sbto/index.md) = show-branch --topo-order + +git submodule: + + * [git sm](git-sm/index.md) = submodule + * [git smi](git-smi/index.md) = submodule init + * [git sma](git-sma/index.md) = submodule add + * [git sms](git-sms/index.md) = submodule sync + * [git smu](git-smu/index.md) = submodule update + * [git smui](git-smui/index.md) = submodule update --init + * [git smuir](git-smuir/index.md) = submodule update --init --recursive + +git status: + + * [git s](git-s/index.md) = status + * [git ss](git-ss/index.md) = status --short + * [git ssb](git-ssb/index.md) = status --short --branch + +git whatchanged: + + * [git w](git-w/index.md) = whatchanged + + +## Friendly aliases + +Recommended helpers: + + * [git initer](git-initer/index.md) - Initialize a repo using our recommended way i.e. with an empty rebaseable commit + * [git cloner](git-cloner/index.md) - Clone a repo using our recommended way i.e. recursive include of submodules + * [git pruner](git-pruner/index.md) - Prune a repo using our recommnded way i.e. prune everything unreachable now + * [git repacker](git-repacker/index.md) - Repack a repo our recommended way i.e. as Linus Torvalds describes + * [git optimizer](git-optimizer/index.md) - Optimize a repo using our recommended way i.e. by pruning and repacking + +Quick highlights: + + * [git chart](git-chart/index.md) + * [git churn](git-churn/index.md) + * [git summary](git-summary/index.md) + +Branch names: + + * [git default-branch](git-default-branch/index.md) - Show the default branch name + * [git current-branch](git-current-branch/index.md) - Show the current branch name + * [git upstream-branch](git-upstream-branch/index.md) - Show the upstream branch name + * [git topic-base-branch](git-topic-base-branch/index.md) - Show 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) + +Friendly plurals: + + * [git aliases](git-aliases/index.md) - List aliases + * [git branches](git-branches/index.md) - List branches + * [git tags](git-tags/index.md) - List tags + * [git stashes](git-stashes/index.md) - List stashes + +Undo: + + * [git uncommit](git-uncommit/index.md) = reset --soft HEAD~1 + * [git unadd](git-unadd/index.md) = reset HEAD + +Logging & reporting: + + * [git log-*](git-log/index.md) (many aliases) + * [git who](git-who/index.md) + +Lookups: + + * [git whois](git-whois/index.md) - Try to figure out an author's information + * [git whatis](git-whatis/index.md) - Try to figure out an object's information + +Commit details: + + * [git commit-parents](git-commit-parents/index.md) - Show the commit's parents + * [git commit-is-merge](git-commit-is-merge/index.md) - Is the commit a merge commit? + * [git commit-message-key-lines](git-commit-message-key-lines/index.md) + +Add all & edit all: + + * [git add-*](git-edit/index.md) - Add all files of a given type + * [git edit-*](git-edit/index.md) - Edit all files of a given type + +Alias helpers: + + * [git add-alias](git-add-alias/index.md) - Create a new git alias + * [git move-alias](git-move-alias/index.md) - Rename an existing git alias + +Script helpers: + + * [git top](git-top/index.md) - Get the top level directory name + * [git exec](git-exec/index.md) - Execute a shell script + +Remotes: + + * [git remotes-prune](git-remotes-prune/index.md) - For each remote branch, prune it + * [git remotes-push](git-remotes-push/index.md) - For each remote branch, push it + +New repos: + + * [git init-empty](git-init-empty/index.md) - Initialize a repo with an empty rebaseable commit + * [git clone-lean](git-clone-lean/index.md) - Clone a repo as lean as possible + +Hew branches: + + * [git hew](git-hew/index.md) - Delete all branches that are merged into a commit + * [git hew-dry-run](git-hew/index.md) - Delete all branches that are merged into a commit (dry run) + * [git hew-local](git-hew-local/index.md) - Delete local branches that are merged into a commit + * [git hew-local-dry-run](git-hew-local/index.md) - Delete local branches that are merged (dry run) + * [git hew-remote](git-hew-remote/index.md) - Delete remote branches that are merged into a commit + * [git hew-remote-dry-run](git-hew-remote-dry-rn/index.md) - Delete remote branches that are merged into a commit (dry run) + +Saving work: + + * [git archive](git-archive/index.md) - Create an archive file of everything in the repo + * [git snapshot](git-snapshot/index.md) - Stash a snapshot of your current working tree + * [git panic](git-panic/index.md) - When you're worried the world is coming to an end + +Misc: + + * [git init-empty](git-init-empty/index.md) - Initialize a repo with an empty rebaseable commit + * [git diff-*](git-diff/index.md) + * [git grep-*](git-grep/index.md) + * [git merge-span-*](git-merge-span/index.md) - Merge span aliases + * [git orphans](git-orphans/index.md) - Find all objects that aren't referenced by any other object + * [git fixup](git-fixup/index.md) - Fix a commit by amending it + * [git rev-list-all-objects-by-size](git-rev-list-all-objects-by-size/index.md) + * [git rev-list-all-objects-by-size-and-name](git-rev-list-all-objects-by-size-and-name/index.md) + * [git cherry-pick-merge](git-cherry-pick-merge/index.md) + * [git refs-by-date](git-refs-by-date/index.md) - Sort by date for branches + +Advanced aliases: + + * [git search-commits](git-search-commits/index.md) + * [git debug](git-debug/index.md) + * [git intercommit](git-intercommit/index.md) + + +## Workflow aliases + +Topic branching for feature workflows: + + * [git topic-*](git-topic/index.md) - Read this first about topic aliases. + * [git topic-base-branch](git-topic-base-branch/index.md) - Show the topic base branch name + * [git topic-begin](git-topic-begin/index.md) - Start a new topic branch + * [git topic-end](git-topic-end/index.md) - Finish the current topic branch + * [git topic-sync](git-topic-sync/index.md) - Synchronize the current topic branch + * [git topic-move](git-topic-move/index.md) - Rename the current topic branch + +Flow aliases: + + * [git get & git put](git-get-git-put/index.md) + * [git ours & git theirs](git-ours-git-theirs/index.md) + * [git wip & git unwip](git-wip-git-unwip/index.md) + * [git assume & git unassume](git-assume-and-git-unassume/index.md) + * [git publish & git unpublish](git-publish-git-unpublish/index.md) + +reset & undo: + + * [git reset-*](git-reset/index.md) - Move backwards on the commit chain; synonym for undo-* + * [git undo-*](git-undo/index.md) - Move backwards on the commit chain; synonym for reset-* + +track & untrack: + + * [git track](git-track/index.md) - Start tracking from a local branch to upstream branch + * [git untrack](git-untrack/index.md) - Stop tracking from a local branch to upstream branch + +inbound & outbound: + + * [git inbound](git-inbound/index.md) - Show incoming changes compared to upstream + * [git outbound](git-outbound/index.md) - Show outgoing changes compared to upstream + +pull1 & push1: + + * [git pull1](git-pull1/index.md) - Pull just the current branch + * [git push1](git-push1/index.md) - Push just the current branch + +Misc: + + * [git issues](git-issues/index.md) - Show issues that are described in commit messages + * [git expunge](git-expunge/index.md) - Use filter-branch to delete a file everywhere + * [git reincarnate](git-reincarnate/index.md) - Kill a branch then create it anew + * [git diff-chunk](git-diff-chunk/index.md) - Do a diff of two chunks in revisions + * [git last-tag](git-last-tag/index.md) - Show the last tag in the current branch + * [git serve](git-serve/index.md) - Serve the local directory via git server daemon + * [git track-all-remote-branches](git-track-all-remote-branches/index.md) - Track all remote branches + * [git cleaner](git-cleaner/index.md) - Clean a working tree using more power options + * [git cleanest](git-cleanest/index.md) - Clean a working tree using the most power options + * [git cleanout](git-cleanout/index.md) - Clean a working tree using typical options then checkout + + +## Tooling aliases + +Use gitk: + + * [git gitk-conflict](git-gitk-conflict/index.md) - Use gitk to show conflicting merge + * [git gitk-history-all](git-history-all/index.md) - Use gitk to show full history + +Use other version control systems: + + * [git cvs-*](git-cvs/index.md) - Use CVS version control + * [git svn-*](git-svn/index.md) - Use Subversion version control + +Use graphviz: + + * [git graphviz](git-graphviz/index.md) - Use graphviz for display + + +## Index of all aliases + + * [git a](git-a/index.md) - Short for "git add" + * [git aa](git-aa/index.md) - Short for "git add --all" - Add all paths + * [git add-alias](git-add-alias/index.md) - Create a new git alias + * [git add-cached](git-add-cached/index.md) - Add cached files + * [git add-deleted](git-add-deleted/index.md) - Add deleted files + * [git add-ignored](git-add-ignored/index.md) - Add ignored files + * [git add-killed](git-add-killed/index.md) - Add killed files + * [git add-modified](git-add-modified/index.md) - Add modified files + * [git add-others](git-add-others/index.md) - Add other files + * [git add-stage](git-add-stage/index.md) - Add stage files + * [git add-unmerged](git-add-unmerged/index.md) - Add unmerged files + * [git aliases](git-aliases/index.md) - List git aliases + * [git ap](git-ap/index.md) - Short for "git add --patch" - Add by patch + * [git archive](git-archive/index.md) - Create an archive file of everything in the repo + * [git assume-all](git-assume-all/index.md) - Assume all files are unchanged + * [git assume](git-assume/index.md) - Assume files are unchanged + * [git assumed](git-assumed/index.md) - Show which files are assumed + * [git au](git-au/index.md) - Short for "git add --update" + * [git b](git-b/index.md) - Short for "git branch" + * [git bed](git-bed/index.md) - Edit the description of a branch + * [git bm](git-bm/index.md) - List branches whose tips are reachable from the specified commit (HEAD if not specified) + * [git bnm](git-bnm/index.md) - List branches whose tips are not reachable from the specified commit (HEAD if not specified) + * [git branch-commit-first](git-branch-commit-first/index.md) - Show a branch's first commit hash (or hashes) + * [git branch-commit-last](git-branch-commit-last/index.md) - Show a branch's last commit hash (or hashes) + * [git branch-commit-next](git-branch-commit-next/index.md) - Show a branch's next commit hash (or hashes) + * [git branch-commit-prev](git-branch-commit-prev/index.md) - Show a branch's previous commit hash (or hashes) + * [git branch](git-branch/index.md) - Aliases related to git branch + * [git branches](git-branches/index.md) - List branches + * [git bsd](git-bsd/index.md) - Show the description of a branch + * [git bv](git-bv/index.md) - List branch information with hash and subject + * [git bvv](git-bvv/index.md) - List branch information with hash and subject and upstream + * [git c](git-c/index.md) - Short for "git commit" + * [git ca](git-ca) - Amend the tip of the current branch; do not create a new commit + * [git cam](git-cam) - Amend the tip of the current branch; edit the message + * [git cane](git-cane/index.md) - Amend the tip of the current branch; do not edit the message + * [git chart](git-chart/index.md) - Show a summary chart of activity per author + * [git cherry-pick-merge](git-cherry-pick-merge/index.md) - Cherry pick a merge commit + * [git churn](git-churn/index.md) - Show log of files that have many changes + * [git ci](git-ci/index.md) - Commit interactive + * [git cleaner](git-cleaner/index.md) - Clean a working tree using more power options + * [git cleanest](git-cleanest/index.md) - Clean a working tree using the most power options + * [git cleanout](git-cleanout/index.md) - Clean a working tree using typical options then checkout + * [git clone-lean](git-clone-lean/index.md) - Clone as lean as possible + * [git cloner](git-cloner/index.md) - Clone a repository and recurse on any of its submodules + * [git cm](git-cm/index.md) - Commit with a message + * [git co](git-co/index.md) - Checkout a.k.a. update the working tree to match a branch or paths + * [git commit-is-merge](git-commit-is-merge/index.md) - Is the commit a merge commit? If yes exit 0, else exit 1 + * [git commit-message-key-lines](git-commit-message-key-lines/index.md) - Show the commit's keyword-marker lines + * [git commit-parents](git-commit-parents/index.md) - Show the commit's parents + * [git cong](git-cong/index.md) - Checkout with no guessing + * [git count](git-count/index.md) - + * [git cp](git-cp/index.md) - Cherry-pick - apply the changes introduced by some existing commits; + * [git cpa](git-cpa/index.md) - Abort the cherry-pick process + * [git cpc](git-cpc/index.md) - Continue the cherry-pick process + * [git cpn](git-cpn/index.md) - Cherry-pick with no commit + * [git cpnx](git-cpnx/index.md) - Cherry-pick with no commit and with explanation + * [git current-branch](git-current-branch/index.md) - Get the current branch name + * [git hew](git-hew/index.md) - Delete branches that have been merged into a commit + * [git hew-dry-run](git-hew-dry-run/index.md) - Delete branches that have been merged into a commit (dry run) + * [git hew-local](git-hew-local/index.md) - Delete local branches that have been merged into a commit + * [git hew-local-dry-run](git-hew-local-dry-run/index.md) - Delete local branches that have been merged into a commit (dry run) + * [git hew-remote](git-hew-remote/index.md) - Delete remote branches that have been merged into an upstream commit + * [git hew-remote-dry-run](git-hew-remote-dry-run/index.md) - Delete remote branches that have been merged into an upstream commit (dry run) + * [git cvs-e](git-cvs-e/index.md) - CVS export + * [git cvs-i](git-cvs-i/index.md) - CVS import + * [git d](git-d/index.md) - Short for "git diff" + * [git dc](git-dc/index.md) - Diff in order to show changes not yet staged + * [git dd](git-dd/index.md) - Diff deep - show changes with our preferred options + * [git debug](git-debug/index.md) - Help debugging builtins + * [git default-branch](git-default-branch/index.md) - Get the default branch name + * [git diff-all](git-diff-all/index.md) - For each diff, call difftool + * [git diff-changes](git-diff-changes/index.md) - Show diff of changes + * [git diff-chunk](git-diff-chunk/index.md) - Show the diff of one chunk + * [git diff-deep](git-diff-deep/index.md) - Diff with deep information using our preferred options, a.k.a. `dd` + * [git diff-staged](git-diff-staged/index.md) - Show diffs that are cached i.e. staged + * [git diff-stat](git-diff-stat/index.md) - Diff with stat + * [git discard](git-discard/index.md) - Discard changes in a file (or a list of files) in working tree + * [git ds](git-ds/index.md) - Show changes about to be commited + * [git dw](git-dw/index.md) - Show changes by word, not line + * [git edit-cached](git-edit-cached/index.md) - Edit cached files + * [git edit-deleted](git-edit-deleted/index.md) - Edit deleted files + * [git edit-ignored](git-edit-ignored/index.md) - Edit ignored files + * [git edit-killed](git-edit-killed/index.md) - Edit killed files + * [git edit-modified](git-edit-modified/index.md) - Edit modified files + * [git edit-others](git-edit-others/index.md) - Edit other files + * [git edit-stage](git-edit-stage/index.md) - Edit stage files + * [git edit-unmerged](git-edit-unmerged/index.md) - Edit unmerged files + * [git exec](git-exec/index.md) - Execute a shell script + * [git expunge](git-expunge/index.md) - Delete a file everywhere + * [git f](git-f/index.md) - Short for "git fetch" + * [git fa](git-fa/index.md) - Fetch all remotes + * [git fav](git-fav/index.md) - Fetch all remotes, with verbose output + * [git fixup](git-fixup/index.md) - Fix a commit by amending it + * [git g](git-g/index.md) - Short for "git grep" + * [git get](git-get/index.md) - Get all changes for the current branch + * [git gg](git-gg/index.md) - Grep group i.e. search with our preferred options + * [git gitk-conflict](git-gitk-conflict/index.md) - Use gitk tool to show conflicting merge + * [git gitk-history-all](git-gitk-history-all/index.md) - Use gitk tool to show full history + * [git gn](git-gn/index.md) - Grep and show line number + * [git graphviz](git-graphviz/index.md) - Use graphviz tool for display + * [git grep-ack](git-grep-ack/index.md) - + * [git grep-all](git-grep-all/index.md) - Find text in any commit ever + * [git grep-group](git-grep-group/index.md) - Find text and group the output lines, a.k.a. `gg` + * [git heads](git-heads/index.md) - Show log of heads + * [git ignore](git-ignore/index.md) - Ignore all untracked files by appending them to ".gitignore" + * [git inbound](git-inbound/index.md) - Show incoming changes compared to upstream + * [git init-empty](git-init-empty/index.md) - Initalize a repo with an empty rebaseable commit + * [git initer](git-initer/index.md) - Initalize a repo using our recommended way i.e. with an empty rebaseable commit + * [git intercommit](git-intercommit/index.md) - Use interdiff to see patch modifications + * [git issues](git-issues/index.md) - List all issues mentioned in commit messages between range of commits + * [git l](git-l/index.md) - Short for "git log" + * [git last-tag](git-last-tag/index.md) - Show the last tag in the current branch + * [git last-tagged](git-last-tagged/index.md) - Show the last annotated tag in all branches + * [git lfp](git-lfp/index.md) - Show log with first parent + * [git lg](git-lg/index.md) - Show log with a text-based graphical representation of the commit history + * [git ll](git-ll/index.md) - Log list - Show log list with our preferred options and short information + * [git lll](git-lll/index.md) - Log list long - Show log list with our preferred options and long information + * [git lo](git-lo/index.md) - Show log with one line per item + * [git log-1-day](git-log-1-day/index.md) - Show log with the recent day + * [git log-1-hour](git-log-1-hour/index.md) - Show log with the recent hour + * [git log-1-month](git-log-1-month/index.md) - Show log with the recent month + * [git log-1-week](git-log-1-week/index.md) - Show log with the recent week + * [git log-1-year](git-log-1-year/index.md) - Show log with the recent year + * [git log-date-first](git-log-date-first/index.md) - Show the date of the earliest commit, in strict ISO 8601 format + * [git log-date-last](git-log-date-last/index.md) - Show the date of the latest commit, in strict ISO 8601 format + * [git log-fetched](git-log-fetched/index.md) - Show log of fetched commits vs. origin/main + * [git log-fresh](git-log-fresh/index.md) - Show log of new commits after you fetched, with stats, excluding merges + * [git log-graph](git-log-graph/index.md) - + * [git log-list](git-log-list/index.md) - Show log list with our preferred options and short information + * [git log-list-long](git-log-list-long/index.md) - Show log list with our preferred options and long information + * [git log-my](git-log-my/index.md) - Show log with my own commits by my own user email + * [git log-my-day](git-log-my-day/index.md) - Show log with my own recent day + * [git log-my-hour](git-log-my-hour/index.md) - Show log with my own recent hour + * [git log-my-month](git-log-my-month/index.md) - Show log with my own recent month + * [git log-my-week](git-log-my-week/index.md) - Show log with my own recent week + * [git log-my-year](git-log-my-year/index.md) - Show log with my own recent year + * [git log-of-count-and-day](git-log-of-count-and-day/index.md) - Show log with count and day + * [git log-of-count-and-day-of-week](git-log-of-count-and-day-of-week/index.md) - Show log with count and day of week + * [git log-of-count-and-email](git-log-of-count-and-email/index.md) - Show log with count and email + * [git log-of-count-and-format](git-log-of-count-and-format/index.md) - Show log with count and custom format string + * [git log-of-count-and-format-with-date](git-log-of-count-and-format-with-date/index.md) - Show log with count and custom format string and date + * [git log-of-count-and-hour](git-log-of-count-and-hour/index.md) - Show log with count and hour + * [git log-of-count-and-hour-of-day](git-log-of-count-and-hour-of-day/index.md) - Show log with count and hour of day + * [git log-of-count-and-month](git-log-of-count-and-month/index.md) - Show log with count and month + * [git log-of-count-and-week](git-log-of-count-and-week/index.md) - Show log with count and week + * [git log-of-count-and-week-of-year](git-log-of-count-and-week-of-year/index.md) - Show log with count and week of year + * [git log-of-count-and-year](git-log-of-count-and-year/index.md) - Show log with count and year + * [git log-of-day-and-count](git-log-of-day-and-count/index.md) - Show log with day and count + * [git log-of-day-of-week-and-count](git-log-of-day-of-week-and-count/index.md) - Show log with week and count + * [git log-of-email-and-count](git-log-of-email-and-count/index.md) - Show log with email and count + * [git log-of-format-and-count](git-log-of-format-and-count/index.md) - Show a specific format string and count of log entries + * [git log-of-format-and-count-with-date](git-log-of-format-and-count-with-date/index.md) - Show log with custom format string and count with date + * [git log-of-hour-and-count](git-log-of-hour-and-count/index.md) - Show log with hour and count + * [git log-of-hour-of-day-and-count](git-log-of-hour-of-day-and-count/index.md) - Show log with hour of day and count + * [git log-of-month-and-count](git-log-of-month-and-count/index.md) - Show log with month and count + * [git log-of-week-and-count](git-log-of-week-and-count/index.md) - Show log with week and count + * [git log-of-week-of-year-and-count](git-log-of-week-of-year-and-count/index.md) - Show log with week of year and count + * [git log-of-year-and-count](git-log-of-year-and-count/index.md) - Show log with year and count + * [git log-refs](git-log-refs/index.md) - Show log with commits that are referred by some branch or tag + * [git log-timeline](git-log-timeline/index.md) - + * [git lp](git-lp/index.md) - Show log with patch generation + * [git ls](git-ls/index.md) - List files in the index and the working tree; like Unix "ls" command + * [git lsd](git-lsd/index.md) - List files and show debug information + * [git lsfn](git-lsfn/index.md) - List files and show full name + * [git lsio](git-lsio/index.md) - List files that git is ignoring + * [git lto](git-lto/index.md) - Show log with items appearing in topological order + * [git m](git-m/index.md) - Short for "git merge" + * [git ma](git-ma/index.md) - Merge abort i.e. abort the merge process + * [git mainly](git-mainly/index.md) - Make local like main + * [git mc](git-mc/index.md) - Merge continue i.e. continue the merge process + * [git mncnf](git-mncnf/index.md) - Merge with no autocommit, and with no fast-forward + * [git merge-span](git-merge-span/index.md) - Merge span aliases + * [git merge-span-diff](git-merge-span-diff/index.md) - Show the changes that were introduced by a merge + * [git merge-span-difftool](git-merge-span-difftool/index.md) - Show the changes that were introduced by a merge, in your difftool + * [git merge-span-log](git-merge-span-log/index.md) - Find the commits that were introduced by a merge + * [git move-alias](git-move-alias/index.md) - Rename an existing git alias + * [git o](git-o/index.md) - Short for "git checkout" + * [git optimizer](git-optimizer/index.md) - Optimize the repository by pruning and repacking + * [git orphans](git-orphans/index.md) - Find all objects that aren't referenced by any other object + * [git ours](git-ours/index.md) - Checkout our version of a file and add it + * [git outbound](git-outbound/index.md) - Show outgoing changes compared to upstream + * [git p](git-p/index.md) - Short for "git pull" + * [git panic](git-panic/index.md) - When you're a little worried that the world is coming to an end + * [git pf](git-pf/index.md) - Pull if a merge can be resolved as a fast-forward, otherwise fail + * [git pr](git-pr/index.md) - Pull with rebase i.e. provide a cleaner, linear, bisectable history + * [git prp](git-prp/index.md) - Pull with rebase preserve of merge commits + * [git pruner](git-pruner/index.md) - Prune everything that is unreachable now + * [git publish](git-publish/index.md) - Publish the current branch + * [git pull1](git-pull1/index.md) - Pull just the one current branch + * [git push1](git-push1/index.md) - Push just the one current branch + * [git pushy](git-pushy/index.md) - Push with force and lease + * [git put](git-put/index.md) - Put all changes for the current branch + * [git rb](git-rb/index.md) - Short for "git rebase" + * [git rba](git-rba/index.md) - Rebase abort i.e. abort the rebase process + * [git rbc](git-rbc/index.md) - Rebase continue i.e. continue the rebase process + * [git rbi](git-rbi/index.md) - Rebase interactive i.e. do a rebase with prompts + * [git rbiu](git-rbiu/index.md) - Rebase interactive on unpushed commits + * [git rbs](git-rbs/index.md) - Rebase skip i.e. restart the rebase process by skipping the current patch + * [git rebase-branch](git-rebase-branch/index.md) - Interactively rebase all the commits on the current branch + * [git rebase-recent](git-rebase-recent/index.md) - Rebase recent commits with interactive + * [git ref-recent](git-ref-recent/index.md) - + * [git refs-by-date](git-refs-by-date/index.md) - Show refs sorted by date for branches + * [git reincarnate](git-reincarnate/index.md) - Delete a branch then create it anew + * [git remote-ref](git-remote-ref/index.md) - TODO + * [git remotes-prune](git-remotes-prune/index.md) - For each remote branch, prune it + * [git remotes-push](git-remotes-push/index.md) - For each remote branch, push it + * [git repacker](git-repacker/index.md) - Repack a repo as recommended by Linus + * [git reset-commit](git-reset-commit/index.md) - Reset a commit with a soft reset + * [git reset-commit-hard](git-reset-commit-hard/index.md) - Reset a commit with a hard reset + * [git reset-commit-hard-clean](git-reset-commit-hard-clean/index.md) - Reset a commit with a hard reset and a clean + * [git reset-to-pristine](git-reset-to-pristine/index.md) - Reset commits and clean all differences + * [git reset-to-upstream](git-reset-to-upstream/index.md) - Reset commits back to the upstream branch + * [git rev-list-all-objects-by-size-and-name](git-rev-list-all-objects-by-size-and-name/index.md) - List all objects by size in bytes and file name + * [git rev-list-all-objects-by-size](git-rev-list-all-objects-by-size/index.md) - List all blobs by size in bytes + * [git rl](git-rl/index.md) - Short for "git reflog" + * [git rr](git-rr/index.md) - Short for "git remote" + * [git rrp](git-rrp/index.md) - Remote prune i.e. delete all stale remote-tracking branches under + * [git rrs](git-rrs/index.md) - Remote show i.e. give information about the remote + * [git rru](git-rru/index.md) - remote update i.e. fetch updates for a named set of remotes in the repository as defined by remotes + * [git rv](git-rv/index.md) - Short for "git revert" + * [git rvnc](git-rvnc/index.md) - Revert with no commit i.e. without autocommit + * [git s](git-s/index.md) - Short for "git status" + * [git sb](git-sb/index.md) - Short for "git show-branch" i.e. print a list of branches and their commits + * [git search-commits](git-search-commits/index.md) - Search for a given string in all patches and print commit messages + * [git serve](git-serve/index.md) - Serve the local directory by starting a git server daemon + * [git show-unreachable](git-show-unreachable/index.md) - Show logs of unreachable commits + * [git sm](git-sm/index.md) - Short for "git submodule" + * [git sma](git-sma/index.md) - Submodule add i.e. add a submodule to this repo + * [git smi](git-smi/index.md) - Submodule init i.e. initialize a submodule in this repo + * [git sms](git-sms/index.md) - Submodule sync i.e. synchronize a submodule in this repo + * [git smu](git-smu/index.md) - Submodule update i.e. update a submodule in this repo + * [git smui](git-smui/index.md) - Submodule update with initialize + * [git smuir](git-smuir/index.md) - Submodule update with initialize and recursive; this is useful to bring a submodule fully up to date + * [git snapshot](git-snapshot/index.md) - Take a snapshot of your current working tree + * [git ss](git-ss/index.md) - Status with short format + * [git ssb](git-ssb/index.md) - Status with short format and branch info + * [git stashes](git-stashes/index.md) - List stashes + * [git summary](git-summary/index.md) - Show a summary of some typical metrics + * [git svn-b](git-svn-b/index.md) - Subversion branch + * [git svn-c](git-svn-c/index.md) - Subversion commit + * [git svn-cp](git-svn-cp/index.md) - Subversion cherry pick + * [git svn-m](git-svn-m/index.md) - Subversion merge + * [git tags](git-tags/index.md) - List tags + * [git theirs](git-theirs/index.md) - Checkout their version of a file and add it + * [git top](git-top/index.md) - Get the top level directory name + * [git topic-*](git-topic/index.md) - Read this first about topic aliases + * [git topic-base-branch](git-topic-base-branch/index.md) - Show the project base topic branch name + * [git topic-move](git-topic-move/index.md) - Rename the current topic branch + * [git topic-begin](git-topic-begin/index.md) - Start a new topic branch + * [git topic-end](git-topic-end/index.md) - Finish the current topic branch + * [git topic-sync](git-topic-sync/index.md) - Synchronize the current topic branch by doing updates + * [git track-all-remote-branches](git-track-all-remote-branches/index.md) - Track all remote branches that aren't already being tracked + * [git track](git-track/index.md) - Start tracking a branch, with default parameters, and showing the command + * [git unadd](git-unadd/index.md) - Reset something that's been added + * [git unassume-all](git-unassume-all/index.md) - Unassume all files + * [git unassume](git-unassume/index.md) - Unassume files + * [git uncommit](git-uncommit/index.md) - Reset one commit + * [git undo-commit](git-undo-commit/index.md) - Undo a commit with a soft reset + * [git undo-commit-hard](git-undo-commit-hard/index.md) - Undo a commit with a hard reset + * [git undo-commit-hard-clean](git-undo-commit-hard-clean/index.md) - Undo a commit with a hard reset and a clean + * [git undo-to-pristine](git-undo-to-pristine/index.md) - Undo commits and clean all differences + * [git undo-to-upstream](git-undo-to-upstream/index.md) - Undo commits back to the upstream branch + * [git unpublish](git-unpublish/index.md) - Unpublish the current branch + * [git untrack](git-untrack/index.md) - Stop tracking a branch, with default parameters, and showing the command + * [git unwip](git-unwip/index.md) - Load "work in progress" + * [git upstream-branch](git-upstream-branch/index.md) - Get the upstream branch name + * [git w](git-w/index.md) - Short for "git whatchanged" + * [git whatis](git-whatis/index.md) - Given a git object, try to show it briefly + * [git who](git-who/index.md) - Show a short log of who has contributed commits, in descending order + * [git whois](git-whois/index.md) - Given a string for an author, try to figure out full name and email + * [git wip](git-wip/index.md) - Save "work in progress" + + +### Tracking + + * Package: gitalias + * Version: 27.0.0 + * Created: 2016-06-17T22:05:43Z + * Updated: 2022-01-09T19:00:32Z + * License: GPL-2.0-or-later or contact us for custom license + * Contact: Joel Parker Henderson (joel@joelparkerhenderson.com) diff --git a/doc/index/index.md b/doc/index/index.md deleted file mode 100644 index 73cd6cd1..00000000 --- a/doc/index/index.md +++ /dev/null @@ -1,4 +0,0 @@ -title = "Git Alias" -sort_by = "name" -template = "base.html" -page_template = "base.html" diff --git a/doc/install/install.md b/doc/install/index.md similarity index 88% rename from doc/install/install.md rename to doc/install/index.md index 983bd4ac..034dc1c6 100644 --- a/doc/install/install.md +++ b/doc/install/index.md @@ -1,5 +1,3 @@ -page_template = "base.html" - # Install @@ -7,8 +5,8 @@ page_template = "base.html" Download the file [`gitalias.txt`](gitalias.txt) and include it: -```sh -curl https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt -o ~/.gitalias +```shell +curl https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt -o ~/.gitalias git config --global include.path ~/.gitalias ``` @@ -17,13 +15,13 @@ git config --global include.path ~/.gitalias Download the file [`gitalias.txt`](gitalias.txt) any way you want, such as: -```sh +```shell curl -O https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt ``` Manually edit your git config dot file any way you want, such as: -```sh +```shell vi ~/.gitconfig ``` diff --git a/doc/introduction/introduction.md b/doc/introduction/index.md similarity index 90% rename from doc/introduction/introduction.md rename to doc/introduction/index.md index d91a7c8b..bdbb2d02 100644 --- a/doc/introduction/introduction.md +++ b/doc/introduction/index.md @@ -1,5 +1,3 @@ -page_template = "base.html" - # Introduction @@ -11,7 +9,7 @@ Git Alias is a collection of git version control shortcuts, functions, and comma * Improvements such as `optimize` to do a prune and repack with recommended settings. - * Workflows such as `topic-start` to create a new topic branch for a new feature. + * Workflows such as `topic-begin` to create a new topic branch for a new feature. * Visualizations such as `graphviz` to show logs and charts using third-party tools. diff --git a/doc/more/more.md b/doc/more/index.md similarity index 88% rename from doc/more/more.md rename to doc/more/index.md index 66d4599d..d66c45ad 100644 --- a/doc/more/more.md +++ b/doc/more/index.md @@ -1,8 +1,6 @@ -page_template = "base.html" +# More ideas -# Resources - -More ideas for git improvements: +For more ideas for git improvements: * If you want to alias the git command, then use your shell, such as `alias g=git`. @@ -18,7 +16,7 @@ More ideas for git improvements: * If you use `node` then see [git-alias](https://www.npmjs.com/package/git-alias) -For more git config ideas, and for credit for many of the aliases here, please see these excelent resources: +For more ideas for git config, and for credit for many of the aliases here, please see these excelent resources: * @@ -34,13 +32,13 @@ For more git config ideas, and for credit for many of the aliases here, please s * - * + * * * [Human Git Aliases](http://gggritso.com/human-git-aliases) -References: +For more ideas for references: * [Git Basics - Git Aliases](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases) diff --git a/doc/site/templates/template.html b/doc/site/templates/template.html new file mode 100644 index 00000000..5bdb1e55 --- /dev/null +++ b/doc/site/templates/template.html @@ -0,0 +1,38 @@ + + + + + + {{title}} - GitAlias + + + + + + + + +
+ {{content}} +
+ + + + + diff --git a/doc/thanks/thanks.md b/doc/thanks/index.md similarity index 94% rename from doc/thanks/thanks.md rename to doc/thanks/index.md index 5d405b4f..e43655bb 100644 --- a/doc/thanks/thanks.md +++ b/doc/thanks/index.md @@ -1,8 +1,6 @@ -page_template = "base.html" - # Thanks -Thanks to all the contributors, including all the creators of the projects mentioned above. +Thanks to all the contributors, including all the creators of the projects described here. Thanks to these people for extra help, in order of participation: @@ -31,3 +29,4 @@ Thanks to these people for extra help, in order of participation: * [YantaoZhao](https://github.com/yantaozhao) * [Jeff Wu](https://github.com/WuTheFWasThat) * [Gareth Owen](https://github.com/gwjo) + * [NariyasuHeseri](https://github.com/NariyasuHeseri) \ No newline at end of file diff --git a/doc/todo/todo.md b/doc/todo/index.md similarity index 95% rename from doc/todo/todo.md rename to doc/todo/index.md index 4fc4fb66..7d9591cb 100644 --- a/doc/todo/todo.md +++ b/doc/todo/index.md @@ -1,5 +1,3 @@ -page_template = "base.html" - # To do list To do list in priority order: diff --git a/gitalias.txt b/gitalias.txt index e4bbee84..d09bfe30 100644 --- a/gitalias.txt +++ b/gitalias.txt @@ -1,7 +1,8 @@ # -*- mode: gitconfig; -*- # vim: set filetype=gitconfig: + ## -# GitAlias.com file of many git alias items, including shortcuts, +# GitAlias.com collection of many git alias items, including shortcuts, # helpers, workflows, utilties, visualizers, reports, etc. # # @@ -56,17 +57,17 @@ # ## Tracking # # * Package: gitalias -# * Version: 26.0.0 -# * Created: 2016-06-17T00:00:00Z -# * Updated: 2021-10-16T16:41:08Z -# * License: GPL-2.0-only +# * Version: 27.0.0 +# * Created: 2016-06-17T22:05:43Z +# * Updated: 2022-01-03T15:56:43Z +# * License: GPL-2.0-only or contact us for custom license # * Contact: Joel Parker Henderson (joel@joelparkerhenderson.com) ## [alias] ## - # One letter alias for our most frequent commands. + # Short aliases for frequent commands. # # Guidelines: these aliases do not use options, because we want # these aliases to be easy to compose and use in many ways. @@ -86,12 +87,12 @@ w = whatchanged ## - # Short aliases for our frequent commands. + # Short aliases for frequent commands and options. ## - ### add ### + ### add aliases ### - # add all + ## add all aa = add --all # add by patch - looks at each change, and asks if we want to put it in the repo. @@ -100,7 +101,7 @@ # add just the files that are updated. au = add --update - ### branch ### + ### branch aliases ### # branch and only list branches whose tips are reachable from the specified commit (HEAD if not specified). bm = branch --merged @@ -117,15 +118,15 @@ git config \"branch.$branch.description\"; \ };f" - # branch verbose: When in list mode, show sha1, commit subject line, relationship, etc. + # branch verbose: When in list mode, show the hash, the commit subject line, etc. # This is identical to doing `git b -v`. bv = branch --verbose - # branch verbose x2: When in list mode, show path, upstream branch, etc. + # branch verbose verbose: When in list mode, show the hash the commit subject line, the upstream branch, etc. # This is identical to doing `git b -vv`. bvv = branch --verbose --verbose - ### commit ### + ### commit aliases ### # commit - amend the tip of the current branch rather than creating a new commit. ca = commit --amend @@ -142,13 +143,13 @@ # commit with a message cm = commit --message - ### checkout ### + ### checkout aliases ### # checkout - update the working tree to match a branch or paths. [same as "o" for "out"] co = checkout cong = checkout --no-guess - ### cherry-pick ### + ### cherry-pick aliases ### # cherry-pick - apply the changes introduced by some existing commits; useful for moving small chunks of code between branches. cp = cherry-pick @@ -165,29 +166,29 @@ # cherry-pick --no-commit a.k.a. without making a commit, and when when recording the commit, append a line that says "(cherry picked from commit ...)" cpnx = cherry-pick -n -x - ### diff ### + ### diff aliases ### - # diff - show changes not yet staged + # Show changes not yet staged dc = diff --cached - # diff - show changes about to be commited + # Show changes about to be commited ds = diff --staged - # diff - show changes but by word, not line + # Show changes but by word, not line dw = diff --word-diff - # diff deep - show changes with our preferred options. Also aliased as `diff-deep`. - dd = diff --check --dirstat --find-copies --find-renames --histogram --color + # Show changes with our preferred options; a.k.a. `diff-deep` + dd = diff-deep - ### fetch ### + ### fetch aliases ### - # fetch all - fetch all remotes. + # Fetch all remotes fa = fetch --all - # fetch all verbose - fetch all remotes, with verbose output. + # Fetch all remotes and use verbose output fav = fetch --all --verbose - ### grep ### + ### grep aliases ### # grep i.e. search for text g = grep @@ -195,10 +196,10 @@ # grep with -n (--line-number) means show line number gn = grep -n - # grep group - search with our preferred options. Also aliased as `grep-group`. - gg = grep --break --heading --line-number --color + # Search with our preferred options; a.k.a. `grep-group` + gg = grep-group - ### log ### + ### log aliases ### # log with a text-based graphical representation of the commit history. lg = log --graph @@ -206,6 +207,9 @@ # log with one line per item. lo = log --oneline + # log with one line per item, in reverse order i.e. recent items first. + lor = log --oneline --reverse + # log with patch generation. lp = log --patch @@ -215,13 +219,13 @@ # log with items appearing in topological order, i.e. descendant commits are shown before their parents. lto = log --topo-order - # log like - we like this summarization our key performance indicators. Also aliased as `log-like`. - ll = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' + # log list - Show log list with our preferred options, a.k.a. `log-list` + ll = log-list - # log like long - we like this summarization our key performance indicators. Also aliased as `log-like-long`. - lll = log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --abbrev=40 --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%Creset %Cblue%G?%Creset' + # log list long - Show log list with our preferred options with long information, a.k.a. `log-list-long` + lll = log-list-long - ## ls-files ## + ### ls-files aliases ### # ls-files - show information about files in the index and the working tree; like Unix "ls" command. ls = ls-files @@ -247,7 +251,7 @@ # lsio = ls-files --ignored --others --exclude-standard - ### merge ### + ### merge aliases ### # merge abort - cancel the merging process ma = merge --abort @@ -256,20 +260,20 @@ mc = merge --continue # merge but without autocommit, and with a commit even if the merge resolved as a fast-forward. - me = merge --no-commit --no-ff + mncnf = merge --no-commit --no-ff - ### pull ### + ### pull aliases ### - # pull if a merge can be resolved as a fast-forward, otherwise fail. + # pf - Pull if a merge can be resolved as a fast-forward, otherwise fail. pf = pull --ff-only - # pull with rebase - to provide a cleaner, linear, bisectable history. + # pp - Pull with rebase in order to provide a cleaner, linear, bisectable history # # To automatically do "pull --rebase" everywhere: # # git config --global pull.rebase true # - # To automatically do "pull --rebase" for any branch based on + # To automatically do "pull --rebase" for any branch based on # the branch "main": # # git config branch.main.rebase true @@ -296,7 +300,7 @@ # pr = pull --rebase - # pp - pull with rebase preserve of merge commits + # prp - Pull with rebase preserve of merge commits # # See https://stackoverflow.com/questions/21364636/git-pull-rebase-preserve-merges # @@ -336,9 +340,9 @@ # internal merges, which are sort of warning signs that rebasing might # not be a good idea. # - pp = pull --rebase=preserve + prp = pull --rebase=preserve - ### rebase ### + ### rebase aliases ### # rebase - forward-port local commits to the updated upstream head. rb = rebase @@ -390,12 +394,12 @@ # This is a slightly modified version fixup = "!f() { TARGET=$(git rev-parse \"$1\"); git commit --fixup=$TARGET && GIT_EDITOR=true git rebase --interactive --autosquash $TARGET~; }; f" - ### reflog ### + ### reflog aliases ### # reflog - reference log that manages when tips of branches are updated. rl = reflog - ### remote ### + ### remote aliases ### # remote - manage set of tracked repositories [same as "r"]. rr = remote @@ -409,7 +413,7 @@ # remote prune - deletes all stale remote-tracking branches under . rrp = remote prune - ### revert ### + ### revert aliases ### # revert - undo the changes from some existing commits rv = revert @@ -417,12 +421,12 @@ # revert without autocommit; useful when you're reverting more than one commits' effect to your index in a row. rvnc = revert --no-commit - ### show-branch ### + ### show-branch aliases ### # show-branch - print a list of branches and their commits. sb = show-branch - ### submodule ### + ### submodule aliases ### # submodule - enables foreign repositories to be embedded within a dedicated subdirectory of the source tree. sm = submodule @@ -445,7 +449,7 @@ # submodule update with initialize and recursive; this is useful to bring a submodule fully up to date. smuir = submodule update --init --recursive - ### status ### + ### status aliases ### # status with short format instead of full details ss = status --short @@ -453,7 +457,7 @@ # status with short format and showing branch and tracking info. ssb = status --short --branch - ### ALIAS MANAGEMENT ### + ### alias management aliases ### # git add-alias: create a new git alias. add-alias = "!f() { \ @@ -501,15 +505,15 @@ };f" # Last tag in the current branch - lasttag = describe --tags --abbrev=0 + last-tag = describe --tags --abbrev=0 - # Latest annotated tag in all branches - lasttagged = !git describe --tags `git rev-list --tags --max-count=1` + # Last annotated tag in all branches + last-tagged = !git describe --tags `git rev-list --tags --max-count=1` # From https://gist.github.com/492227 heads = !"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-* ### + ### diff-* aliases ### diff-all = !"for name in $(git diff --name-only $1); do git difftool $1 $name & done" diff-changes = diff --name-status -r @@ -519,7 +523,7 @@ # Diff using our preferred options. A.k.a. `dd`. diff-deep = diff --check --dirstat --find-copies --find-renames --histogram --color - ### grep-* ### + ### grep-* aliases ### # Find text in any commit ever. grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f" @@ -534,12 +538,14 @@ -c color.grep.match=\"reverse yellow\" \ grep --break --heading --line-number - ### init ### + ### init-* aliases ### - # initalize a repo and immediate add an empty commit, which makes rebase easier. + # Initalize a repo and immediately add an empty rebaseable commit. + # 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. init-empty = !"f() { git init && git commit --allow-empty --allow-empty-message --message ''; }; f" - ### merge-* ### + ### merge-span-* aliases ### # Given a merge commit, find the span of commits that exist(ed). # Not so useful in itself, but used by other aliases. @@ -556,7 +562,7 @@ merge-span-difftool = !"git difftool `git merge-span ... $1`" # Interactively rebase all the commits on the current branch - rebase-branch = !"git rebase --interactive `git merge-base main HEAD`" + rebase-branch = "!f() { git rebase --interactive $(git merge-base $(git default-branch)) HEAD); }; f" # Sort by date for branches; can be useful for spring cleaning refs-by-date = for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short)' @@ -578,43 +584,37 @@ # By [raphinesse](https://stackoverflow.com/users/380229/raphinesse) rev-list-all-objects-by-size-and-name = !"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" - ### LOG ALIASES ### - - # Show log of changes, most recent first - log-changes = log --oneline --reverse + ### log-* aliases ### # Show log of new commits after you fetched, with stats, excluding merges log-fresh = log ORIG_HEAD.. --stat --no-merges - # Show log in our preferred format for our key performance indicators. A.k.a. `ll`. - log-like = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' + # Show log list with our preferred information, a.k.a. `ll` + log-list = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' - # Show log in our preferred format for our key performance indicators, with long items. A.k.a. `lll`. - log-like-long = log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%Creset %Cblue%G?%Creset' + # Show log list with our preferred information with long formats, a.k.a. `lll` + log-list-long = log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%Creset %Cblue%G?%Creset' - # Show log with dates in our local timezone - log-local = log --date=local - - # Show the log for my own commits by my own user email + # Show log for my own commits by my own user email log-my = !git log --author $(git config user.email) # Show log as a graph log-graph = log --graph --all --oneline --decorate - # Show the date of the earliest commit, in strict ISO 8601 format - log-first-date = !"git log --date-order --format=%cI | tail -1" + # Show the date of the first (a.k.a. earliest) commit, in strict ISO 8601 format + log-date-first = !"git log --date-order --format=%cI | tail -1" - # Show the date of the latest commit, in strict ISO 8601 format - log-latest-date = log -1 --date-order --format=%cI + # Show the date of the last (a.k.a. latest) commit, in strict ISO 8601 format + log-date-last = log -1 --date-order --format=%cI - # Show the log of the recent hour, day, week, month, year - log-hour = log --since=1-hour-ago - log-day = log --since=1-day-ago - log-week = log --since=1-week-ago - log-month = log --since=1-month-ago - log-year = log --since=1-year-ago + # Show log with the recent hour, day, week, month, year + 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 - # Show the log of my own recent hour, day, week, month, year + # Show log with my own recent hour, day, week, month, year log-my-hour = !git log --author $(git config user.email) --since=1-hour-ago log-my-day = !git log --author $(git config user.email) --since=1-day-ago log-my-week = !git log --author $(git config user.email) --since=1-week-ago @@ -750,7 +750,7 @@ # churn: show log of files that have many changes # - # * Written by (Corey Haines)[http://coreyhaines.com/] + # * Written by [Corey Haines](http://coreyhaines.com/) # * Scriptified by Gary Bernhardt # * Obtained from https://github.com/garybernhardt/dotfiles/blob/main/bin/git-churn # * Edited for GitAlias.com repo by Joel Parker Henderson @@ -802,7 +802,8 @@ printf \"Summary of this branch...\n\"; \ printf \"%s\n\" $(git rev-parse --abbrev-ref HEAD); \ printf \"%s first commit timestamp\n\" $(git log --date-order --format=%cI | tail -1); \ - printf \"%s latest commit timestamp\n\" $(git log -1 --date-order --format=%cI); \ + printf \"%s last commit timestamp\n\" $(git log -1 --date-order --format=%cI); \ + printf \"\nSummary of counts...\n\"; \ printf \"%d commit count\n\" $(git rev-list --count HEAD); \ printf \"%d date count\n\" $(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\n\" $(git tag | wc -l); \ @@ -820,7 +821,7 @@ printf \"\nMost-active files, with churn count\n\"; git churn | head -7; \ }; f" - ### SHOW COMMIT HASHES VIA ORDERING ### + ### branch-commit-* aliases to show hashes via sort order ### # Show a branch's commit hash (or multiple hashes) # by using ordering keywords ("first" or "last"): @@ -871,7 +872,7 @@ count="${2:-1}"; \ git log --reverse --pretty=%H "$branch" | \ head -"$count"; \ - }; f" + }; f" # branch-commit-last # @@ -974,11 +975,11 @@ tail +2; \ }; f" - ### REF ALIASES ### + ### ref-* aliases ### ref-recent = "!git for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) %(objectname:short) %(contents:subject)' refs/heads/" - ### LOOKUP ALIASES ### + ### Lookup aliases ### # whois: given a string for an author, try to figure out full name and email: whois = "!sh -c 'git log --regexp-ignore-case -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -" @@ -1052,9 +1053,12 @@ commit-message-key-lines = "!f(){ echo \"Commit: $1\"; git log \"$1\" --format=fuller | grep \"^[[:blank:]]*[[:alnum:]][-[:alnum:]]*:\" | sed \"s/^[[:blank:]]*//; s/:[[:blank:]]*/: /\"; }; f" - ### WORKFLOW ALIASES ### + ### Workflow aliases ### - # Clone a git repository including all submodules + # Init a repo using our recommended way i.e. with an empty rebaseable commit + initer = init-empty + + # Clone a repo using ur recommended way i.e. recursive include of submodules cloner = clone --recursive # Clone as lean as possible, for example to checkout just one subdiretory. @@ -1071,9 +1075,9 @@ # # * --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". + # with: "multiple filter-specs cannot be combined". # - # This uses --filter=tree:0 added in Git 2.20 and --filter=combine + # 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: @@ -1081,13 +1085,13 @@ # git config --local uploadpack.allowfilter 1 # git config --local uploadpack.allowanysha1inwant 1 # - # An extension was made to the Git remote protocol to support this + # 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: https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934 # - clone-lean = clone --depth 1 --filter=combine:blob:none+tree:0 --no-checkout + clone-lean = clone --depth 1 --filter=combine:blob:none+tree:0 --no-checkout # Stash snapshot - from http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ # Take a snapshot of your current working tree without removing changes. @@ -1128,7 +1132,7 @@ # # git config pull.rebase preserve # - # TODO: handle tags, delete superfluous branches, and add error handing. + # TODO: handle tags, and delete superfluous branches, and add error handing. # get = !git fetch --prune && git pull --rebase && git submodule update --init --recursive put = !git commit --all && git push @@ -1137,7 +1141,7 @@ # # TODO: handle tags, and delete superfluous branches, and add error handling. # - mainly = !git checkout main && git fetch origin --prune && git reset --hard origin/main + mainly = !git checkout $(git default-branch) && git fetch origin --prune && git reset --hard origin/$(git default-branch) # Ignore all untracked files by appending them to .gitignore: ignore = "!git status | grep -P \"^\\t\" | grep -vF .gitignore | sed \"s/^\\t//\" >> .gitignore" @@ -1155,22 +1159,23 @@ # better code that works using more-specific git commands. track-all-remote-branches = !"f() { git branch -r | grep -v ' -> ' | sed 's/^ \\+origin\\///' ; }; f" - ## - # Reset & Undo - ## + ### reset-* & undo-* ### # Reset and undo aliases are ways to move backwards on the commit chain. - # We find that novices prefer the wording "undo"; experts prefer "reset". + # In our experience, novice users tend to prefer the wording with "undo", + # and expert users tend to prefer the wording with "reset". + + # Reset commits. reset-commit = reset --soft HEAD~1 reset-commit-hard = reset --hard HEAD~1 - reset-commit-clean = !git reset --hard HEAD~1 && git clean -fd + reset-commit-hard-clean = !git reset --hard HEAD~1 && git clean -fd reset-to-pristine = !git reset --hard && git clean -ffdx reset-to-upstream = !git reset --hard $(git upstream-branch) - # Undo is simply a synonym for "reset" because "undo" can help novices. + # Undo commits. undo-commit = reset --soft HEAD~1 undo-commit-hard = reset --hard HEAD~1 - undo-commit-clean = !git reset --hard HEAD~1 && git clean -fd + undo-commit-hard-clean = !git reset --hard HEAD~1 && git clean -fd undo-to-pristine = !git reset --hard && git clean -ffdx undo-to-upstream = !git reset --hard $(git upstream-branch) @@ -1178,10 +1183,16 @@ uncommit = reset --soft HEAD~1 unadd = reset HEAD - # Discard changes in a (list of) file(s) in working tree + # Discard changes in a (list of) file(s) in working tree. discard = checkout -- - # Clean and discard changes and untracked files in working tree + # Clean a working tree using more powerful options. + cleaner = clean -dff + + # Clean a working tree using the most powerful options. + cleanest = clean -dffx + + # Clean a working tree using typical options then checkout. cleanout = !git clean -df && git checkout -- . # Expunge a file everywhere; this command is typically for a serious problem, @@ -1194,6 +1205,8 @@ # This can be useful, for example, when recovering contents of dropped stashes or reset commits. show-unreachable = !"git fsck --unreachable | grep commit | cut -d\" \" -f3 | xargs git log" + ### add-* & edit-* - Handle files by kind ### + # Add all files of the given type add-cached = !"f() { git ls-files --cached | sort -u ; }; git add `f`" add-deleted = !"f() { git ls-files --deleted | sort -u ; }; git add `f`" @@ -1214,42 +1227,54 @@ 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`" - # Ours & Theirs - easy merging when you know which files you want + # Ours & Theirs - Easy merging when you know which files you want # # Sometimes during a merge you want to take a file from one side wholesale. # # The following aliases expose the ours and theirs commands which let you # pick a file(s) from the current branch or the merged branch respectively. # - # * ours: checkout our version of a file and add it - # * theirs: checkout their version of a file and add it + # * git ours - Checkout our version of a file and add it + # + # * git theirs - Checkout their version of a file and add it # # N.b. the function is there as hack to get $@ doing # what you would expect it to as a shell user. # + + # Checkout our version of a file and add it. ours = !"f() { git checkout --ours $@ && git add $@; }; f" + + # Checkout their version of a file and add it. theirs = !"f() { git checkout --theirs $@ && git add $@; }; f" - # Work In Progress: from https://gist.github.com/492227 and VonC on stackoverflow. + # Work In Progress - Easy tracking of what you're doing + # + # From https://gist.github.com/492227 and VonC on stackoverflow. + # # This enables a quick way to add all new and modified files to the index, # while 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 will restore the deleted files to the working tree. + + # Add files using the message "wip" wip = !"git add --all; git ls-files --deleted -z | xargs -r -0 git rm; git commit --message=wip" + + # Restore the deleted files to the working tree. unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1" - # Assume + # Assume & Unassume # # 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 + # then you might run into the need to ignore certain files which are under the # Subversion control, yet you need to modify them but not commit. + # # The assume-unchanged flag comes to the rescue. # - # Suppose we want to edit passwords.txt and for god's sake never check it in: + # Suppose we want to edit passwords.txt and for gosh sake never check it in: # # $ git status # modified passwords.txt @@ -1269,21 +1294,49 @@ # # Thanks to http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/ # Thanks to http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ - + # assume = update-index --assume-unchanged unassume = update-index --no-assume-unchanged assume-all = "!git st -s | awk {'print $2'} | xargs -r git assume" unassume-all = "!git assumed | xargs -r git update-index --no-assume-unchanged" assumed = !"git ls-files -v | grep ^h | cut -c 3-" - # Delete all branches that have already been merged into the main branch. - cull-branches = !git cull-local-branches; git cull-remote-branches; + ### hew-* ### + + # Delete all branches that have been merged into a commit + hew = !git hew-local "$@" && git hew-remote "$@"; + + # Delete all branches that have been merged into a commit (dry run) + hew-dry-run = !git hew-local-dry-run "$@" && git hew-remote-dry-run "$@"; + + # Delete all local branches that have been merged into a commit + hew-local = !"f() { \ + hew-local-dry-run \"$@\" | \ + xargs git branch --delete ; \ + }; f \"$@\"" - # Delete all local branches that have been merged into the local main branch. - cull-local-branches = "!git checkout main && git branch --merged | xargs -r git branch --delete" + # Delete all local branches that have been merged into a commit (dry run) + hew-local-dry-run = !"f() { \ + commit=${1:-$(git current-branch)}; \ + git branch --merged \"$commit\" | \ + grep -v \"^[[:space:]]*\\*[[:space:]]*$commit$\" ; \ + }; f \"$@\"" - # Delete all remote branches that have been merged into the remote main branch. - cull-remote-branches = !"git branch --remotes --merged origin/main | sed 's# *origin/##' | grep -v '^main$' | xargs -r -I% git push origin :% 2>&1 | grep --colour=never 'deleted'" + # Delete all remote branches that have been merged into a commit + hew-remote = !"f() { \ + hew-remote-dry-run \"$@\" | \ + xargs -I% git push origin :% 2>&1 ; \ + }; f \"$@\"" + + # Delete all remote branches that have been merged into a commit (dry run) + hew-remote-dry-run = !"f() { \ + commit=${1:-$(git upstream-branch)}; \ + git branch --remotes --merged \"$commit\" | \ + grep -v \"^[[:space:]]*origin/$commit$\" | \ + sed 's#[[:space:]]*origin/##' ; \ + }; f \"$@\"" + + ### publish & unpublish ### # Publish the current branch by pushing it to the remote "origin", # and setting the current branch to track the upstream branch. @@ -1293,10 +1346,12 @@ # remote version of the current branch. unpublish = !"git push origin :$(git current-branch)" - # git inbound: show incoming changes with upstream. + ### inbound & outbound ### + + # Show incoming changes with upstream. inbound = !git remote update --prune; git log ..@{upstream} - # git outbound: show outgoing changes with upstream. + # Show outgoing changes with upstream. outbound = log @{upstream}.. # Delete a branch name, then create the same branch name based on main - @@ -1315,15 +1370,19 @@ stashes = stash list - ### SHELL SCRIPTING ALIASES ### + ### Shell scripting aliases ### - # Get the top level directory name - top-name = rev-parse --show-toplevel + # Show the top level directory name + top = rev-parse --show-toplevel - # Get the current branch name + # Show the default branch name + default-branch = config init.defaultBranch + + # Show the current branch name + # Newer versions of git can do: git branch --show-current current-branch = rev-parse --abbrev-ref HEAD - # Get the upstream branch name + # Show the upstream branch name upstream-branch = !git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD) # Execute shell scripts. Git always runs scripts in the top directory. @@ -1333,9 +1392,6 @@ ### MAINTENANCE ALIASES ### - # cleaner: clean everything to be pristine - cleaner = clean -ffdx - # pruner: prune everything that is unreachable now. # # This command takes a long time to run, perhaps even overnight. @@ -1390,17 +1446,22 @@ ### ADVANCED ALIASES ### # Search for a given string in all patches and print commit messages. - # Posted by Mikko Rantalainen on StackOverflow. # # Example: search for any commit that adds or removes string "foobar" - # git searchcommits foobar + # + # git search-commits foobar # # Example: search commits for string "foobar" in directory src/lib - # git searchcommits foobar src/lib + # + # git search-commits foobar src/lib # # Example: search commits for "foobar", print full diff of commit with 1 line context - # git searchcommits foobar --pickaxe-all -U1 src/lib - searchcommits = !"f() { query=\"$1\"; shift; git log -S\"$query\" \"$@\"; }; f \"$@\"" + # + # git search-commits foobar --pickaxe-all -U1 src/lib + # + # Posted by Mikko Rantalainen on StackOverflow. + # + search-commits = !"f() { query=\"$1\"; shift; git log -S\"$query\" \"$@\"; }; f \"$@\"" # A 'debug' alias to help debugging builtins: when debugging builtins, # we use gdb to analyze the runtime state. However, we have to disable @@ -1436,7 +1497,7 @@ # git remotes-prune - For each remote branch, prune it. # There's no way to tell `git remote update` to prune stale branches, - # and `git remote prune` does not currently understand `--all`. + # and `git remote prune` does not currently understand `--all`. # So this shell command iterates on each remote, and prunes it. remotes-prune = !git remote | xargs -n 1 git remote prune @@ -1466,11 +1527,12 @@ # Serve the local directory by starting a git server daemon, so others can pull/push from my machine serve = "-c daemon.receivepack=true daemon --base-path=. --export-all --reuseaddr --verbose" + ########################################################################## + ### Topic branch aliases ########################################################################## - # Git alias settings suitable for topic branches. + # Topic branch aliases which are starting points for your own workflow. # - # 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 @@ -1478,15 +1540,15 @@ # # Start work on a new topic branch, which creates your branch: # - # $ git topic-start add-feature-foo + # $ git topic-begin add-feature-foo # # Do work, and optionally sync our changes, which pushes and pulls: # # $ git topic-sync - # + # # Stop work on a topic branch, which deletes your branch: # - # $ git topic-stop + # $ git topic-end # # If you want to move your branch a.k.a. rename it: # @@ -1506,22 +1568,22 @@ # # When we create a new topic branch, we base it on the topic base branch. # - # Many projects use the topic base branch name "main". Some projects use + # Many projects use the topic base branch name "main". Some projects use # use "trunk", "develop", "deploy", "integrate", "release", "green", etc. # - # The topic base branch name is "main" by default. You can customize - # the name for your local repo, or your own user's global configuration, + # The topic base branch name is "main" by default. You can customize + # the name for your local repo, or your own user's global configuration, # or your system configuration, by using `git config` such as: # - # $ git config --local init.topicBaseBranchName "foo" + # $ git config --local init.topicBaseBranchName "foo" # - # $ git config --global init.topicBaseBranchName "foo" + # $ git config --global init.topicBaseBranchName "foo" # - # $ git config --system init.topicBaseBranchName "foo" + # $ git config --system init.topicBaseBranchName "foo" # # Thanks to https://github.com/gwjo - topic-base = "!f(){ \ + topic-base-branch = "!f(){ \ git config --get init.topicBaseBranchName || printf '%s\n' main; \ };f" @@ -1529,7 +1591,7 @@ # # Example: # - # git topic-start add-feature-foo + # git topic-begin add-feature-foo # # We use this alias to begin work on a new feature, # new task, new fix, new refactor, new optimization, etc. @@ -1549,9 +1611,9 @@ # the team provide feedback on the work-in-progress, and also to # run any automatic tests to verify the branch runs successfully. - topic-start = "!f(){ \ + topic-begin = "!f(){ \ new_branch=\"$1\"; \ - old_branch=$(git topic-base); \ + old_branch=$(git topic-base-branch); \ git checkout \"$old_branch\"; \ git pull --ff-only; \ git checkout -b \"$new_branch\" \"$old_branch\"; \ @@ -1562,7 +1624,7 @@ # # Example: # - # git topic-stop + # git topic-end # # We use this alias to complete work on a new feature, # new task, new fix, new refactor, new optimization, etc. @@ -1586,15 +1648,15 @@ # That's fine; it means someone else has already deleted the branch. # To synchronize your branch list, use "git fetch --prune". - topic-stop = "!f(){ \ + topic-end = "!f(){ \ new_branch=$(git current-branch); \ - old_branch=$(git topic-base); \ + old_branch=$(git topic-base-branch); \ if [ \"$new_branch\" = \"$old_branch\" ]; then \ - printf \"You are asking to do git topic-stop,\n\"; \ + printf \"You are asking to do git topic-end,\n\"; \ printf \"but you are not on a new topic branch;\n\"; \ printf \"you are on the base topic branch: $old_branch.\n\"; \ printf \"Please checkout the topic branch that you want,\n\"; \ - printf \"then retry the git topic-stop command.\n\"; \ + printf \"then retry the git topic-end command.\n\"; \ else \ git push; \ git checkout \"$old_branch\"; \ @@ -1622,7 +1684,7 @@ topic-sync = "!f(){ \ new_branch=$(git current-branch); \ - old_branch=$(git topic-base); \ + old_branch=$(git topic-base-branch); \ if [ \"$new_branch\" = \"$old_branch\" ]; then \ printf \"You are asking to do git topic-sync,\n\"; \ printf \"but you are not on a new topic branch;\n\"; \ @@ -1656,7 +1718,9 @@ };f" - ########################################################################## + ######################################################################## + ### Integration aliases + ######################################################################## ## # Git aliases suitable for particular software integrations and tooling,