git/README.md
Kenneth Benzie (Benie) 1294ea01f2 Remove checkout-last alias
Since `git checkout -` does the same thing as `git checkout-last`
there's no need for the alias.
2018-08-26 16:42:29 +01:00

46 lines
2.2 KiB
Markdown

# Git Configuration
## Aliases
A set of [Git][git] [aliases][aliases] which follow the idea "say what you mean"
rather than remembering the plumbing term of a specific command.
* `abandon` abandons all local changes leave a clean repository.
* `unstage` unstage staged changes, shorthand for `git reset -q HEAD --`.
* `amend` amends the last commit, shorthand for `git commit --amend`.
* `fixup` prepare to fixup a commit, shorthand for `git commit --fixup`.
* `squash` prepare to squash a commit, shorthand for `git commit --squash`.
* `prepare` prepare a branch for merging into another, shorthand for
`git rebase --interactive --fork-point`.
* `list` list local branches, a shorthand for `git branch`.
* `create` creates a new branch, shorthand for `git checkout -b`.
* `delete` deletes an existing branch, shorthand for `git branch -D`.
* `name` the name of the current branch.
* `last` the name of the last branch checked out before the current branch.
* `publish` push and set the tracking branch of a local branch to origin,
shorthand for `git push -u origin <branch>`.
* `unpublish` delete a remote branch, shorthand for `git push origin :<branch>`.
* `force` force push local changes to the remote, shorthand for
`git push --force-with-lease`.
* `changes` compare the list of commits on the local branch to another branch,
e.g. when on a feature branch `git changes master` lists the commits which are
not present on the master branch.
* `save` like pushing to the stash but attached to the current branch, shorthand
for `git commit -am "temp!"`.
* `load` like popping from the stash but attached to the current branch, if
`HEAD` has the subject `temp!` then `git reset --mixed HEAD~` is executed,
otherwise the message `error: commit subject is not: temp!` is output.
## Zsh Completions
The excellent [Git][git] completions provided by [Zsh][zsh] which can see
through [aliases][aliases] however some aliases involve multiple commands or
rely on the shell to function. The following aliases extend the default
[Git][git] completions.
* `git changes` completions for the branch name to compare with are provided.
[git]: https://git-scm.com
[aliases]: https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
[zsh]: https://www.zsh.org