Git Explained in 100 Seconds
get a system for keeping track of
changes that happen across a set of
files open a directory on your local
system with an editor like vs code then
run get an it from the command line you
just created a git repository or repo it
lives in this hidden get directory and
keeps track of all the changes that
happen to these files as you work on a
codebase you take snapshots or commits
of the current state of these files
every commit has a unique ID and is
linked to its parent and this means we
can travel back in time to a previous
version of our files notice how our
source control icon is lit up currently
all of our files are untracked because
we need to add them to the repo run get
add to include or stage these files in
the repo then create a snapshot of their
current state by running git commit
along with a message about what you did
to these files congratulations
you just created the first commit on the
head of the master branch in this repo
the changed files disappeared and you're
now on a clean working directory the
head represents the most recent commit
if we make some changes commit them to
the repo the head moves forward but we
still have a reference to our previous
commits so we can always go back to it
but the thing about software is that
it's developed in a nonlinear fashion
you might have multiple teams working on
different features for the same codebase
simultaneously it makes that possible by
branching create one by running git
branch and then rank it check out to
move into that branch you can now safely
work on your feature in this branch
without affecting the code or files in
the master branch the commits you make
here live in an alternate universe with
its own unique history at some point
though you'll likely want to merge this
history with the history and the master
branch when you're ready go back to the
master branch by running git checkout
then run git merge on your
alternate-universe
the tip of your feature branch now
becomes the head of the master branch
where in other words our fragmented
universe has become one unless he ran
into a merge conflict in which case
you'll just have to wait for the sequel
this has been get explained in 100
seconds if you want to see more short
videos like this make sure to hit the
like button subscribe and let me know
what you think in the comments thanks
for watching and I will see you in the
next one
you