Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
The course shows how to use Git, the popular open-source version control software, to manage changes to source code and text files. Using a step-by-step approach, author Kevin Skoglund presents the commands that enable efficient code management and reveals the fundamental concepts behind version control systems and the Git architecture. Discover how to track changes to files in a repository, review previous edits, and compare versions of a file; create branches to test new ideas without altering the main project; and merge those changes into the project if they work out. The course begins by demonstrating version control in a single-user, standalone context, before exploring how remote repositories allow users to collaborate on projects effectively.
In the last movie we got an idea of how tracking branches work. In this movie, we will apply that while we also push some more changes up to the remote repository that we created. Notice that I'm inside my explore_ california directory, and I'm on the master branch. Before we can push some changes we need to make some changes. The change that I have in mind is going to be into the tours page. So let's open up tours.html, and if you notice over here I've got Backpack Cal, and I've got a link here that takes me to the Backpack Cal page, that page does exist.
Notice that the link that will take me to for that is tour_detail_backpack_cal.html, that's the format of the file name. Now California Calm does not exist yet, I don't have that page created. But notice that the page at once that take me to is tourDetail_calm.html, so the change that I want to make is for each one of these to put them in the same format as the one that does exist. So even though these don't go to files that are actually there yet, we're going to go and change the link so that if that file existed, and had the same format as Backpack Cal, it would go there.
All right, so let's make that change. So inside tours.html I'll open that up, and I'm just going to do a quick search for Detail, and I'm not going to Ignore case, and there it is, there is the first one, Detail_calm. So we'll make it _detail, do a search for the next one _detail, and the next one _detail, _detail, _detail, so a whole bunch of these.
Okay, so I've got all of those now. So I'm going to save this document and close it up, git status, we see the changes there. Let's go ahead and do git commit, and I'll do it with the -am option, so it'll do it all at once, and we'll say, "Change file/link format on tours.html." Okay, so now I've committed that change. Now just to be clear this is just a local operation.
This is the same kind of stuff we were doing at the very beginning, has nothing to do with the remotes whatsoever. We're just making a basic commit to our own master branch, our own local repository. Now at this point that's the only place that that change exists. So git log --oneline, there is the change right there, f3a370e. If we do git log --oneline origin/ master, that's the remote branch. Actually it's my copy of the remote branch, and you can see that it's not there right now, and we can actually compare the two by saying git diff master with origin/master, and actually probably you should swap those around because origin/master is behind master, and there's the changes. So that's all the changes that I just made between the two.
So what I want to do now is push my changes. All right, remember that we're pushing the changes just like we push the initial code we're going to push to origin master. So we can do git push origin master, and that's the exact same command that we used before to push up our changes, but because this is a tracking branch, remember we set it to be a tracking branch, we can just say git push. Much, much shorter. Git push wants to know my username, and there it is, it pushed. It knew where to push to because we're tracking that branch.
So whenever we do fetches and whenever we do pushes, it will assume that we want to go to that tracking branch. Very convenient. Saves you a lot of typing and having to think about what you're doing. You can just say git push, and it will push all the changes up to the remote branch. We can now see that that change is there, git log --oneline, and let's do origin/master, and let's just do the first three, and there it is. You'll see that it now shows up there. And sure enough, if you go back now to GitHub, and you take a look at GitHub, you'll see that the master branch now has that commit.
In fact, here it is latest commit to the master branch, Change file/link format on tours.html authored three minutes ago, and here's the commit number. If we click on that, it comes up and it shows us that same diff that we were looking at. So that we can see what the commit was. Now let's go back to our command line, and let's switch to our other project, the lynda_version. So this is as if we're looking at it from Lynda's point of view, from her repository. So we'll go backwards and into Lynda's version, and from here we'll say git log --oneline, and you can see that Lynda does not have that change yet.
It's in the explore_california repository, it's up on the remote repository, but lynda hasn't seen it. And that's because Lynda still needs to do a fetch in order to retrieve whatever changes have been pushed up the remote repository. Let's see how to do that in the next movie.
Find answers to the most frequently asked questions about Git Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.