git/README.md
Kenneth Benzie (Benie) 467789389a Improve save/load aliases
When `git load` is invoked it will check if the subject of the `HEAD`
commit message is `temp!`, if it is when the commit will be reset,
otherwise an error message is output and the commit remains untouched.
2018-08-11 19:24:55 +01:00

35 lines
1.7 KiB
Markdown

# Git Configuration
## Aliases
A set of [Git][git] aliases which follow the idea "say what you mean" rather
than remember the plumbing term of a specific command.
* `abandon` abandons all local changes leave a clean repository.
* `amend` amends the last commit, shorthand for `git commit --amend`.
* `unstage` unstage staged changes, shorthand for `git reset -q HEAD --`.
* `squash` perform an interactive rebase to squash all commits since branching,
shorthand for `git rebase -i --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.
* `checkout-last` checkout the last branch, shorthand for
`git checkout $(git last)`.
* `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.
[git]: https://git-scm.com