Super-Useful Git Aliases That Will Speed Up Your Coding
Reduce the time you spend typing full-length commands and prevent annoying typos

The most effective way to understand the purpose of each alias is by testing them during the reading, so before we start, let’s go step by step and set them up on your machine:
- Copy the following content:
2. Open ~/.gitconfig
for editing:
vi ~/.gitconfig
3. Paste the alias list under [alias]
. In case you don’t see it, you can add it by yourself:
[alias]
st = status
s = switch
cp = cherry-pick
...
4. Save and exit.
You’ve now armed with aliases! Now let’s learn how we can use them and start firing up our terminal!
Shortened Aliases
This kind of group contains the simplest Git aliases that you can create. Their whole purpose is shortening long Git commands to something that’s easy to write and remember.
Let’s go over them and explain what they actually are under the hood.
st
Shortened alias for status
.
amend
Amends the head
commit without opening the message editor.
sw
Shortened alias for switch
(added in Git v2.23).
cp(c/s/a)
Shortened alias for cherry-pick
.
cpc
— Used to continue after resolving conflicts duringcherry-pick
.cps
— Used to skip conflicts duringcherry-pick
.cpa
— Used to abort the currentcherry-pick
operation.
rb(c/s/a)
Shortened alias for rebase
.
rbc
— Used to continue after resolving conflicts duringrebase
.rbs
— Used to skip conflicts duringrebase
.rba
— Used to abort the currentrebase
operation.
ras
Restores all the current staged changes by using restore
(added in Git v2.23).
puh
Pushes the current branch to the remote as a new branch.
wip
Commits the staged changes with a WIP
message. Useful when switching between “in progress” branches.
Functional Aliases
This kind of group allows us to provide arguments to the aliases and benefit from the advantages of dynamic commands. For example, they could be really useful for aliases that need a specific commit or branch name to work with.
As you can see in the gist, the functional aliases start with !
, which allows us to run shell commands. Then, we define a function that has our Git command and call this function immediately after its declaration (the last f
). To use the provided arguments, you can access them as normal shell parameters ($1
, $2
, etc.).
Now let’s see how can we use each of them.
bm [branch_name]
Renames the current branch name with the provided new name.
fu [commit]
Takes the staged changes upon the provided commit without changing the commit message by using fixup
.
fua [commit]
Same as fu
, but it stages all the changes in the working directory automatically.
ir [number]
Starts interactive rebase
from the last number
of commits.
rs [file_path]
Restores the provided staged file by using restore
(added in Git v2.23).
fr [branch_name]
Fetches from the remote the latest version of all branches and rebases the current branch onto the remote version of the provided branch name.
What’s Next?
As you can see, it's so easy to create new aliases in Git, so be creative and write your own aliases when you find yourself repeating long and hard-to-remember commands. Save your priceless time for the real tasks, such as design, coding, and reviews.
Always remember: The tools work for you, so don’t stop with Git aliases and try to improve your productivity with every tool you use in your daily work.
Thanks for reading!