Customizing Git

There are many ways you can customize Git. One of the most useful ways is by creating command aliases. For example, you could create git ds so you don’t have to type git diff --staged. To create this alias, open (or create) a file named ~/.gitconfig and add this:

[alias]
	ds = diff --staged

If you already have an [alias] section, add ds = diff --staged in that section.

Aliases are for more than just making existing commands easier to use. Git and its alias system are powerful enough that you can essentially create entirely new commands, such as Slipp D. Thompson’s log commands.

Git also allows you to create new commands (or even replace existing ones) with an executable file. For example, you can create a git dft command that uses Difftastic’s executable.

see also