2018-05-06-git-aliases
The .gitconfig file in the b-it-bots/dotfiles repository contains some useful aliases to use with git.
Installation
You can copy the contents of the file to the global ~/.gitconfig if you want to use them in all your repositories (recommended).
If you only want to use them in the MAS repositories, copy them to the .git/config in your local copy.
Usage
You can use git aliases like this:
git <alias>Lists
branches- List all your branchestags- List all your tagsstashes- List all your stashesremotes- List all your remotesaliases- Shows a list of your existing aliases
Checking commit history
last- Show your last commitgraph- A graph version of who the commit historyprettylog- Show a pretty log of the commit historyhistory- Show the last 10 commits in a one line pretty formatscrum- Show the commits made by you in the last day (Note: you need to change your name when you copy this alias)
Doing some work
precommit-unmerged-summary- Show the status of files in a short format, including untracked filesunstash <stash index>- To apply the stashed changes to your current workspacesquash <number of commits>- Combine several commits into onebranchdiff- Likegit diffbut for branches
Undoing some work
unstage- Unstage all files that are currently added but have not yet been commited.discard- Discarding changes in file(s)uncommit- Revert your last commitamend- Ammend (fix) your last commit messagenevermind- CAUTION: Discard all the changes on your local directory
Contributors
Argentina Ortega - Original author
See Also
Last updated
Was this helpful?