The letter A styled as Alchemists logo. lchemists
Published October 30, 2019 Updated May 15, 2020

Git Rebase Abbreviations

Demonstrates how to use abbreviations when rebasing for less typing.

Transcript

# Hello and welcome to the Alchemists Screencasts!
# Today, we are going to look Git Rebase Abbreviated Commands.
# To set the stage, here is the Git history for this demo project:

gl

# Only the first commit, "Added gem skeleton", is on the *master* branch.
# The last three commits are on the current *abbreviations* branch.
# Let's see what this looks like in the Git Rebase Editor:

git rebase --interactive

# Notice, when we were in the Git Rebase Editor, it defaulted to "pick" commands.
# If we wanted to instruct Git Rebase to use a different command, we'd have to type each:
# - reword
# - edit
# - fixup
# ...etc...
# This tends to be tedious and time consuming, and hey, we are busy engineers!
# What if you wanted to speed up your workflow?
# Well, good news, you can by adding the following to your Git Configuration:

git config --add rebase.abbreviateCommands true

# Here is what the local Git config looks like (see `[rebase]` section):

cat .git/config

# I *highly* recommend adding this setting to your global Git Configuration.
# You can use the following command to update your global configuration:
#   git config --global --add rebase.abbreviateCommands true
# OK, let's see what effect this has on the Git Rebase Editor:

git rebase --interactive

# Hopefully you noticed how the "pick" commands became abbreviated as "p".
# Now you can use the abbreviated commands instead of typing everything out. 🎉

# Enjoy!
# https://alchemists.io
# ☿ 🜔 🜍 🜂 🜃 🜁 🜄