How to Use Git and GitHub: A Beginner's Guide

TL;DR
Git is free, open-source source control management that tracks file changes over time, letting you compare versions, see who changed what, and revert to previous states. After installing Git, you configure your name and email, initialize a repository with 'git init', then track files using 'git add' and check progress with 'git status'. GitHub is a hosting platform for collaborating on Git repositories.
Transcript
Hi everyone, Kevin here. Today we are going to learn how to use both Git and also GitHub. We'll start with what even is Git and why would you use it. Then we'll look at how you can get Git running on your computer,  and then we'll look at how you can use it. After that, we'll look at GitHub. GitHub is a hosting p... Read More
Key Insights
- Git is open-source and free source control management (SCM) that lets you manage changes to files over time and go back to see what those changes were, so a mistake can be undone by jumping to a previous version.
- Branching lets you make edits safely: you create another version or branch, update the text there, and once confident the changes look good you merge that back into the main branch and commit it so the changes go live.
- Reverting is Git's core benefit: if an operations manager says the original text was actually correct, you can simply revert back to a previous version, compare differences between versions, and see who changed what.
- Git installs from git-scm.com by clicking downloads and selecting your operating system; on Windows it comes with a terminal called Git Bash, though PowerShell, command prompt, the Mac terminal, or Hyper.is also work.
- Configuration requires setting your identity because every commit records who did it: use 'git config --global user.name', 'git config --global user.email', and 'git config --global init.defaultBranch main' to name the default branch main.
- Git offers built-in help: appending '-h' to a command like 'git config' shows help information, while 'git help config' opens a manual hosted on your computer that works even without internet access.
- Initializing a repository is done by changing to the file directory with 'cd' then running 'git init', which creates a hidden '.git' folder containing all the necessary repository files while File Explorer otherwise looks unchanged.
- Tracking is controlled per file: 'git add' followed by a filename starts tracking, 'git rm --cached' plus the filename unstages it, and 'git status' shows the current branch plus which files are tracked or untracked.
Install to Summarize YouTube Videos and Get Transcripts
Explore YouTube Video Summarizer or Get YouTube Transcript Extractor
Questions & Answers
Q: What is Git and why would you use it?
Git is open-source and free source control management, referred to as SCM. With Git you can manage changes to files over time and go back to see what those changes were. It lets you revert back to previous versions, compare the differences between different versions, and see who changed what. If you screw something up, you can simply jump back to a previous version, which is described as the magic of using Git.
Q: How do you install Git on your computer?
Head to the Git website (git-scm.com) or use the link in the description, click on downloads, select your operating system, and run through the installation process. On Windows, Git comes with a terminal called Git Bash, which you launch from the Start menu by typing Git Bash. You can also use PowerShell, command prompt, the terminal that comes with a Mac, or third-party terminals like Hyper.is, so the choice is yours.
Q: How do you configure Git before using it?
You need to specify your name and email because every commit records who is doing it. Type 'git config --global user.name' followed by your name in quotes, then 'git config --global user.email' with your email address. You also set the default branch name with 'git config --global init.defaultBranch main', which names the default branch main. Press enter after each command to apply the configuration.
Q: How do you get help for a Git command?
If you are unsure what a command does or what options it has, you can ask Git for help. Type the command followed by '-h', for example 'git config -h', and press enter to see help information about that command. For more detailed help, type 'git help' followed by the command, such as 'git help config', which opens a manual hosted on your computer that remains accessible even without internet access.
Q: How do you initialize a Git repository?
First change to the directory containing your files using 'cd' (change directory) followed by the file location, then press enter so Git looks at that location. To turn the folder into a Git repository, type 'git init' and press enter. This creates a hidden folder called '.git' that contains all the necessary repository files. In File Explorer it may look unchanged until you enable showing hidden items under the view menu.
Q: What does the git status command tell you?
The 'git status' command tells you the status of your repository. After pressing enter it shows which branch you are currently on, such as the main branch that was set as the default. It reports whether there are any commits yet and lists untracked files. In the example, four untracked files appear, which are the files that make up the website. It is a command you will likely use often.
Q: How do you track and untrack files in Git?
To track a file, type 'git add' followed by the filename, such as 'git add index.htm', then press enter, which starts tracking that file. Confirm it with 'git status'. If you no longer want to track a file, unstage it by typing 'git rm --cached' followed by the filename, for example 'git rm --cached index.htm'. Running 'git status' again returns the file to the original untracked state.
Q: How do you make Git ignore certain files with .gitignore?
Create a new file named '.gitignore' in File Explorer, which lets you ignore certain files, folders, or entire extensions. Open it in a text editor like Notepad. You can add a comment with the hash symbol, such as '# ignore all .txt files', then add a rule like an asterisk followed by '.txt' to ignore any file with that extension. This is useful for files like Employee Salaries.txt that you do not want tracked or seen.
Summary & Key Takeaways
-
Git is free, open-source source control management that manages changes to files over time. On the Kevin Cookie Company website example, you can create a branch, update text, merge it back into the main branch, and commit so changes appear on the website.
-
Git's value is the ability to revert to previous versions, compare differences between versions, and see who changed what. Install it from git-scm.com by choosing your operating system; on Windows it ships with the Git Bash terminal, though other terminals also work.
-
Before use, configure your name, email, and default branch name (main) with 'git config --global'. Initialize a repository with 'git init' inside the file directory, check state with 'git status', and control tracking with 'git add', 'git rm --cached', and a '.gitignore' file.
Read in Other Languages (beta)
Share This Summary 📚
Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator
Explore More Summaries from Kevin Stratvert 📚






Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator