has a strong commitment to backwards compatibility: many powerful features are hidden behind options rather than exposed as default behaviour. Fortunately Git also supports , so you can create your own commands that do all manner of Git magic. Here’s a selection of the more useful (or at least entertaining) aliases defined in my : Git aliases .gitconfig git please $ git config --global alias.please 'push --force-with-lease' Every developer has had the chat with their team lead about force pushing to a shared branch (i.e. don’t do it). Rebasing, amending, and squashing. are all good fun right up until you rewrite some shared history and spill duplicate commits all over your repository. Fortunately, Git won’t let you rewrite history on the server willy-nilly. You have to explicitly pass the option to to show you mean business. But force pushing is a bit heavy handed: it stomps the upstream branch with your local version, and any changes that you hadn’t already fetched are erased from history. --force git push Quality meme courtesy of @tarkasteve Git’s option is far more polite: it checks that your local copy of the ref that you’re overwriting is up-to-date before overwriting it. This indicates that you’ve at least fetched the changes you’re about to stomp. Since is rather a lot to type out each time, I’ve created a polite alias for it: --force-with-lease git push --force-with-lease git please git commend $ git config --global alias.commend 'commit --amend --no-edit' Ever commit and then immediately realize you’d forgotten to stage a file? Fret no more! quietly tacks any staged files onto the last commit you created, re-using your existing commit message. So as long as you haven’t pushed yet, no-one will be the wiser. git commend $ git add Dockerfile$ git commit -m ‘Update Bitbucket pipeline with new Docker image’# (facepalm)$ git add bitbucket-pipelines.yml$ git commend git it $ git config --global alias.it \'!git init && git commit -m “root” --allow-empty' The first commit of a repository can not be rebased like regular commits, so it’s good practice to create an empty commit as your repository root. both initializes your repository and creates an empty root commit in one quick step. Next time you spin up a project, don’t just add it to version control: ! git it git it $ cd shiny-new-thing$ git itInitialized empty Git repository in /shiny-new-thing/.git/[master (root-commit) efc9119] root git staaash $ git config --global alias.stsh 'stash --keep-index'$ git config --global alias.staash 'stash --include-untracked'$ git config --global alias.staaash 'stash --all' is one of the most delightful and useful Git commands. It takes any changes to tracked files in your work tree and them away for later use, leaving you with a clean work tree to start hacking on something else. However if you’ve created any files and haven’t yet staged them, won’t touch them by default, leaving you with a dirty work tree. Similarly, the contents of untracked or ignored files are not stashed by default. git stash stashes new git stash I’ve created a few handy aliases to handle different variations of , based on which bits of your work tree you need to stash: git stash git stsh # stash only unstaged changes to tracked filesgit stash # stash any changes to tracked filesgit staash # stash untracked and tracked filesgit staaash # stash ignored, untracked, and tracked files If in doubt, the long one ( ) will always restore your worktree to what looks like a fresh clone of your repository. git staaash git shorty $ git config --global alias.shorty 'status --short --branch' I run probably more than any other Git command. Git’s inline help has gotten a lot more friendly over the years, which is excellent for beginners, but the output is overly verbose for those more familiar with Git. For example, emits to tell me that I have a couple of staged, unstaged, and untracked changes: git status git status 18 lines $ git statusOn branch masterChanges to be committed:(use “git reset HEAD <file>…” to unstage) modified: package.json Changes not staged for commit:(use “git add <file>…” to update what will be committed)(use “git checkout -- <file>…” to discard changes) modified: package.json Untracked files:(use “git add <file>…” to include in what will be committed) index.js tells me the same thing in 3 lines: git shorty $ git shorty## masterAM test?? .gitignore (OK, so I actually have this aliased as for brevity, but I couldn’t resist.) git st git merc $ git config --global alias.merc 'merge --no-ff' If you’re using a standard non-rebasing branching workflow, running a standard to combine feature branches with master is actually not ideal. With no options, uses the merge strategy, which will only create a merge commit if there are no new changes on the master branch, otherwise it simply “fast forwards” your master branch to point at the latest commit on your feature branch. Only creating a merge commit makes it tricky to reason about which code was developed on which branches when looking through your git history. git merge git merge --ff sometimes uses the strategy, to always create a merge commit. git merc --no-ff Incidentally, is also what we use under the hood (by default) when merging pull requests in . --no-ff Bitbucket git grog $ git config --global alias.grog 'log --graph --abbrev-commit --decorate --all --format=format:"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)"' My (or “ aphical l ”) alias has evolved over the years to the point where I’m no longer sure I understand exactly what it does. But it sure looks pretty: git grog gr og git grog Here’s the standard for comparison: git log git log There are all sorts of available, so fork the command above and make it your own! pretty formats For the GUI fans If you’re a Git GUI fan and using Mac or Windows, you might be using our . If so, you can take advantage of these aliases by creating a new and optional keyboard shortcut — in your preferences: free Git client: Atlassian SourceTree custom action — SourceTree Then you can access it via the -> menu, or your choice of keyboard shortcut: Actions Custom Actions Happy aliasing! If you have some neat Git aliases of your own, share them in the comments, or tweet me . @kannonboy