[git] Add git last alias

Added git alias to show the contents of the last commit. Either use the
long form `git last`, or its alias `gll`.
This commit is contained in:
Marty Oehme 2020-05-28 14:01:50 +02:00
parent d6a2ee7b8a
commit f542c418eb
No known key found for this signature in database
GPG Key ID: 0CCB0526EFB9611A
3 changed files with 15 additions and 6 deletions

View File

@ -10,6 +10,7 @@
[alias]
ignore = "!gitignore -f"
pushmerge = "push -o merge_request.merge_when_pipeline_succeeds" # see https://docs.gitlab.com/ce/user/project/push_options.html#merge-when-pipeline-succeeds-alias
last = "diff HEAD HEAD~"
[commit]
# sign commits as me
gpgsign = true

View File

@ -28,10 +28,15 @@ alias gds='git diff --staged'
alias gi='git ignore'
alias glog='git log --stat'
# show last committed content
alias gll='git last'
# show quick log overview
alias glg='git log --oneline --decorate --graph'
alias glga='git log --oneline --decorate --graph --remotes --all'
alias glgp='git log --stat -p'
# show detailed log overview
alias glog='git log --stat'
# show detailed log overview with contents
alias gloog='git log --stat -p'
alias gf='git fetch'
alias gl='git pull'
@ -68,4 +73,3 @@ esac
alias gstp='git stash pop'
alias gstl='git stash list'
alias gstL='git stash list --stat'

View File

@ -13,8 +13,8 @@ I sign all my commits by default, so take out the corresponding lines if you don
Git will rewrite any remotes using http(s) to use the ssh notation for pushes to github and gitlab so that, even if you set up the repository using an https url you can utilize your usual ssh key for pushing.
Finally, the configuration makes use of a custom pager called `dsf` which is also contained in this module.
It tries to use `diff-so-fancy` if that is installed on the path, otherwise uses git's internal diff prettifier.
Finally, the configuration makes use of a custom pager called `dsf` which is also contained in this module.
It tries to use `diff-so-fancy` if that is installed on the path, otherwise uses git's internal diff prettifier.
If nothing exists it falls back to the standard output.
You can move between changed files in diffs with n/N.
@ -24,9 +24,13 @@ Otherwise, the git config is prepared to handle lfs repositories, and it has an
This module contains a heap of aliases to every-day git commands.
Most of them follow a two-to-three letter combination of things to do which corresponds to the mnemonic of the longer git command.
As such, they are mostly similar to those found in the Oh My Zsh [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)
As such, they are mostly similar to those found in the Oh My Zsh [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git).
Examples of some common aliases are `alias ga=git add`, `alias gst=git status`, `alias gp=git push`, `alias gl=git pull`.
Two aliases might be of note:
`gi` allows quickly generating a gitignore file for the current directory, using the included `gitignore` script.
And `gll` quickly pulls up the contents of the last commit. (`ll` since `gl` already pulls from the remote)
## Gitignore generation script
Adds a `gitignore` script which pulls relevant .gitignore lines from [gitignore.io](https://www.gitignore.io) and sends them to standard out, or creates a .gitignore file in the current directory.