Viewers: in countries Watching now:
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 saw how to undo changes to our working directory. In this movie we're going to see how to undo changes to our staging index or in other words to un-stage things that we've staged there. Before we can get started doing that, we need to add something to our staging area. So let's open up the resources document, resources.html, and if we scroll down here, there's a list of items that it recommends that we bring on an outdoor trip. So here it is, Comfortable hiking shoes, Hat, et cetera. I'm just going to take Sunglasses and Sunscreen and cut those and move them up underneath Hat, because those are pretty important items.
So I'm going to put them near the top. Save our change, close it. Now of course, that changes in our working directory, not staged yet. So if we want to stage it we know that we do add and then resources.html. Now git status. We can see this that change has been staged there. What we want to do now is unstage that change. We don't want lose the change. We want this change to still be in our working directory. The time when you'll most often use this is if you're trying to put together a commit.
Let's say you've got five or six different files of changes that have been made,
and you're trying to assemble them into a commit in the staging area.
But then there's that extra file that you accidentally add.
So I need to unstage that one file, leave all the other ones in there, and then
I'll be ready to make my commit.
That's the real world application of how you would use this.
How do we unstage it?
Well, it gives us a little hint here in the status.
It says (use "git reset HEAD
What we're telling it is go look at the HEAD pointer. The HEAD pointer points to the last commit of the tip of the current branch, which is master. That's our current branch. Go look at that last commit and reset yourself to be the same as what that has. Very similar to what checkout did. Checkout went and checked out that file from the Repo. Here we're resetting the index to be the same as that. So we hit Return. It says Unstaged changes after the reset: is a modification--that's what the M is for--to resources.html.
If we do git status, it tells us something similar. It says that now in our working directory change is not staged. We have a modified file resources.html. If we want to add it to our staging directory, we use git add to put it there. So it's that easy. If you put something into the staging area that you don't want there, you can take it out by using git reset HEAD, and the status message will help you remember that.
Find answers to the most frequently asked questions about Git Essential Training .
Here are the FAQs that matched your search "" :
1. To add "-mmacosx-version-min=10.6" as described here:https://stackoverflow.com/questions/14268887/what-is-the-illegal-instruction-4-error-and-why-does-mmacosx-version-min-10https://stackoverflow.com/questions/10177038/illegal-instruction-4-shows-up-in-os-x-lion
2. Or to use the version of git that comes with Xcode, or to use homebrew to install git instead.http://superuser.com/questions/697144/installed-git-not-sure-how-to-get-it-working
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.