Member-only story
My Favorite Git Aliases
Today it is quite common to be using or have used Git for version control when it comes to Software Engineering. It can get repetitive to type out the full git instructions day in and day out and so shorthand or aliases are common for these commands.
Here are a few that I immediately setup anytime I am working with another developer or am setting up a new machine. Typically I use Z shell and these will go at the bottom of my .zshrc file in my home directory.
Alias #1
alias ga='git add'The number of times you need to add a file to git is VERY high so being able to type ga . instead of git add . saves me a lot of time. Alias it this way and save yourself many keystrokes in your workday.
Alias #2
alias gap='git add -p'This utilizes an interactive prompt to allow you to split changes down into individual commits. When you enter this mode you will be prompted for each chunk of changes in each file. If you enter ? then you can see the list of options.
Stage this hunk [y,n,a,d,/,j,J,g,e,?]? ?
y - stage this hunk
n - do not stage this hunk
a - stage this and all the remaining hunks in the file
d - do not stage this hunk nor any of the remaining hunks in the file
g - select a hunk to go to
/ - search for a hunk matching…