Git Fundamentals

Level up with "Git Fundamentals"

Access all lessons in this tutorial.

No spam, unsubscribe at any time.

This is a free tutorial

In exchange for your email address, you'll get full access to this and other free Epic Web Dev tutorials.

Why? First and foremost, your inbox allows us to directly communicate about the latest Epic Web Dev material. This includes free tutorials, tips, and periodic update about trends, tools, and happenings in Web Development that I'm excited about.

In addition to the piles of free Epic Web Dev content, you'll get the earliest access and best discounts to the paid courses when they launch.

There won't be any spam, and every email you get will have an unsubscribe link.

If this sounds like a fair trade, let's go!

Current section: Commands 17 exercises
lesson

Keeping Branches Updated

When we created our GitHub repo, we ended up with main and remotes/origin/main.

Running the command git branch -a will show us all of our branches, including the remote ones:

$ git branch -a

* main
remotes/origin/main

The * indicates the branch we are currently on.

We used

Subscribe to unlock this lesson.

Transcript

00:00 Git pull is actually two commands in one. It's git fetch and git merge. Remember in our previous lesson when I pointed out that git branch all has two branches, main and remote origin main? Let's see what happens when we split git fetch and git merge from git pull. Let's start by making a new remote file.

00:19 We'll make a new note for git pull, txt, give the heading git pull. Commit as add pull note, which gives us commit that only exists on our remote repository. Now let's run both commands of git pull, our fetch and merge. First, let's run git fetch.

00:38 Git fetch pulls down all of the changes into the origin main branch. So when I run git log, we don't see our note on git pull just yet. And we can run git status to see why. Here we see a new message. Our branch is behind origin main by one commit and can be fast forwarded,

00:56 run git pull to update your local branch. Using git branch all again, it's telling us that this branch is up to date, but not our main branch, the one that we're on. So let's run git merge to merge what we've pulled from our origin main branch into our main branch. That succeeded.

01:14 So we can run git log. And once again, main and origin main are both in sync.

Full Stack Vol 1
You might also like

Full Stack Vol 1

Kent C. Dodds
Kent C. Dodds

A comprehensive guide to full stack development

166 Interactive Exercises ・ Progress Tracking ・ Completion Certificate
Learn more