Fireship · @fireship
13 Advanced (but useful) Git Techniques and Shortcuts
Uploaded September 7, 2021 · Length 8:07
Summary
Learn 13 advanced Git techniques and shortcuts to boost your productivity, including aliases, amend flag, stash, and more.
- git shortcuts
- git productivity
- git techniques
- git aliases
- git amend flag
- git stash
- git bisect
- git rebase
- git hooks
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
one of the best pieces of advice i ever
- 0:01
got was get good at git few things are
- 0:04
more scary for a software engineer than
- 0:06
screwing something up with git after
- 0:08
weeks of writing the perfect code you
- 0:09
submit a pull request and end up with a
- 0:11
bunch of embarrassing failed checks and
- 0:13
merge conflicts next thing you know
- 0:15
you're scrambling on stack overflow
- 0:16
looking for a solution that will likely
- 0:18
just add gasoline to the fire git was
- 0:20
created by a guy much smarter than us he
- 0:22
knew if he made it too easy it would
- 0:23
make us weak instead he wanted to give
- 0:25
us the glory of overcoming the challenge
- 0:34
i'm pretty sure that's what he was
- 0:35
thinking in today's video we'll look at
- 0:36
a bunch of different tips and tricks to
- 0:38
make you more productive with git but if
- 0:40
you're new to git i just released a
- 0:42
short course on fire fireship io that's
- 0:44
designed as a modern learning path to
- 0:45
get you started with git and github it
- 0:47
contains a bunch of short videos along
- 0:49
with exercises to transform you into a
- 0:51
professional git user quickly this
- 0:53
content is supported by viewers like you
- 0:55
and i want to send a huge thank you to
- 0:57
everybody out there who's already a pro
- 0:58
member so to get started i'm assuming
- 1:01
you know the basics of git like you know
- 1:02
how to do a git ad followed by a git
- 1:04
commit to save a snapshot of your code
- 1:06
that's usually the first thing you learn
- 1:08
in git but there's actually a better way
- 1:10
to get the job done you can get rid of
- 1:11
the git add and go straight to commit by
- 1:14
using the am flag this will
- 1:16
automatically add all the files in the
- 1:18
current working directory that's a nice
- 1:20
improvement but there's actually an even
- 1:21
more concise way to get the job done
- 1:23
your git config provides a way to create
- 1:25
aliases which are commonly used to
- 1:27
shorten existing commands or create your
- 1:29
own new custom commands for example we
- 1:31
might create an alias called ac that
- 1:34
runs the add and commit command with
- 1:35
just two letters that allows us to get
- 1:37
things done faster but sometimes going
- 1:39
fast leads to mistakes clearly mistakes
- 1:42
were made what if you made a typo on
- 1:43
your last commit message instead of
- 1:45
resetting and creating a new commit the
- 1:47
amend flag followed by a new message
- 1:49
will simply update the latest commit or
- 1:51
maybe you forgot to include or stage a
- 1:53
couple files with your last commit you
- 1:55
can also update the last commit with new
- 1:57
files by using the amend flag and if you
- 1:59
want to keep the same commit message add


