Git aliases for efficiency or for fun

1 min read

Git alias is a helpful feature that reduces time spent typing commands you use over and over again.

Example

$ git commit

Git commit is like save in a word document. It is a super helpful command that records what you’ve done to the repository, and it’s best practice to do it often.

But you have to type git commit over and over again and what if you want to save a little time. Here is where aliases comes in handy. As a basic example, you can type “git ct” as opposed to “git commit” and have it function the same way.

$ git config --global alias.ct 'commit -v'

Alternatively you can also achieve the same thing by adding this to your git config file:

[alias]
       ct = commit

You can also choose to have a little fun with git alias rather than focus on efficiency.

For example, if you want to Harry Potterify git status you can do:

$ git config --global alias.accio 'status -v'

Or if you think monkeys are the greatest, to which, I agree, you can do:

git config --global alias.monkeysrock 'status -v'