Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
A local tracking branch is one that's associated with a remote branch. There's an advantage to establishing this association. It lets you use the `git pull` command when that tracking branch is checked out.
- Remember that a local tracking branch is one that's associated with a remote branch.
- There's an advantage to establishing this association. It lets you use the
git pull
command when that tracking branch is checked out. - The
git pull
command is like runninggit fetch
followed bygit merge
. It lets you retrieve remote changes and incorporate them into your local tracking branch with a single command. - With
git pull
, you don't have to specify which remote you want to fetch from, or which remote branch you want to merge in, because all of that info is stored by the tracking branch. Your tracking branch will always fetch from the same remote repo, and merge in the same remote branch. - You just type
git pull
, and hit Enter. Git will do the rest:git pull
- Right now, there are no commits in the remote repo's
add-letters
branch to pull over, so it says we're "Already up to date."
- Right now, there are no commits in the remote repo's
$ git pull
Already up to date.
- Let's go back to the remote repo and add a commit:
cd ../decoder
- And I'll check out the
add-letters
branch:git checkout add-letters
- I'll add another conversion to the
decoder.rb
file:
11 => 'K',
- I'll stage it:
git add decoder.rb
- And commit it:
git commit -m 'Add K conversion'
- Now let's go back to our local repo:
cd ../decoder-local
- And run
git pull
again:git pull
- The output looks just like what you'd see if you did a
git fetch origin
followed by agit merge origin/add-letters
.
- The output looks just like what you'd see if you did a
$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /Users/jay/th/decoder
af94e11..09d6fcb add-letters -> origin/add-letters
Updating af94e11..09d6fcb
Fast-forward
decoder.rb | 1 +
1 file changed, 1 insertion(+)
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up