Skip to content
โ† back to home

Git Explained in 100 Seconds

Fireship

youtubeยท 1:55standard

1.Initialize a Git Repository

0:00 / 0:27

This chapter introduces Git as a system for tracking changes in files. It demonstrates how to initialize a Git repository using 'git init' and explains that commits are snapshots of file states with unique IDs, allowing users to revert to previous versions.

  • Git
  • git init
  • repository (repo)
  • commit

What's inside this course

  1. 0:00

    1. Initialize a Git Repository

    This chapter introduces Git as a system for tracking changes in files. It demonstrates how to initialize a Git repository using 'git init' and explains that commits are snapshots of file states with unique IDs, allowing users to revert to previous versions.

  2. 0:27

    2. Stage and Commit Changes

    This chapter explains how to stage files for a commit and then create a commit. It covers the 'git add' command to include files in the repository and 'git commit' to create a snapshot, along with the concept of the 'head' representing the most recent commit.

  3. 0:58

    3. Branching and Merging

    This chapter introduces branching as a way to work on different features simultaneously without affecting the main codebase. It demonstrates how to create a new branch with 'git branch', switch to it with 'git checkout', and then merge changes back into the master branch using 'git merge'.

Every chapter ends with a checkpoint (quiz, flashcards, retell, diagram, or prediction) and the course closes with a final boss-fight. More courses โ†’

Transcript (65 segments)
0:00get a system for keeping track of
0:02changes that happen across a set of
0:04files open a directory on your local
0:06system with an editor like vs code then
0:08run get an it from the command line you
0:10just created a git repository or repo it
0:12lives in this hidden get directory and
0:14keeps track of all the changes that
0:15happen to these files as you work on a
0:17codebase you take snapshots or commits
0:19of the current state of these files
0:21every commit has a unique ID and is
0:23linked to its parent and this means we
0:24can travel back in time to a previous
0:26version of our files notice how our
0:28source control icon is lit up currently
0:30all of our files are untracked because
0:32we need to add them to the repo run get
0:34add to include or stage these files in
0:36the repo then create a snapshot of their
0:38current state by running git commit
0:39along with a message about what you did
0:41to these files congratulations
0:43you just created the first commit on the
0:44head of the master branch in this repo
0:46the changed files disappeared and you're
0:48now on a clean working directory the
0:50head represents the most recent commit
0:52if we make some changes commit them to
0:53the repo the head moves forward but we
0:56still have a reference to our previous
0:57commits so we can always go back to it
0:59but the thing about software is that
1:00it's developed in a nonlinear fashion
1:02you might have multiple teams working on
1:04different features for the same codebase
1:06simultaneously it makes that possible by
1:08branching create one by running git
1:10branch and then rank it check out to
1:12move into that branch you can now safely
1:14work on your feature in this branch
1:15without affecting the code or files in
1:18the master branch the commits you make
1:19here live in an alternate universe with
1:21its own unique history at some point
1:23though you'll likely want to merge this
1:24history with the history and the master
1:26branch when you're ready go back to the
1:28master branch by running git checkout
1:29then run git merge on your
1:31alternate-universe
1:31the tip of your feature branch now
1:33becomes the head of the master branch
1:35where in other words our fragmented
1:37universe has become one unless he ran
1:39into a merge conflict in which case
1:41you'll just have to wait for the sequel
1:43this has been get explained in 100
1:45seconds if you want to see more short
1:46videos like this make sure to hit the
1:48like button subscribe and let me know
1:49what you think in the comments thanks
1:51for watching and I will see you in the
1:53next one
1:55you