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 this chapter we're going to learn about a future of Git called the stash. The stash is a place where we can store changes temporarily without having to commit them to the repository. It's a lot like putting something into a drawer to save it for later. The stash is not part of the repository, the staging index or the working directory, it's a special fourth area in Git, separate from the others. And the things that we put into it aren't commits, but they're a lot like commits, they work in a very similar way. They're still a snapshot of the changes that we were in the process of making, just like a commit is.
But they dont have a SHA associated with them. Let's try making a change, and then we can store it in the stash. Let's start by checking out one of our other branches. Let's check out this shorten_title branch, so git checkout shorten_title. Now the shorten_title branch does not include the changes that we've made to our text_edits branch. So git branch --merged, you'll see that it includes all the changes that are in seo_title, but not the changes that are in either master or in text_edits.
So if you remember back we've made some changes before to the mission file. Let's open up that file again, and let's make another edit to this file. I'm just going to say Explore California: Our Mission, change the title of it. So I'll save that, close it up, git status, we see the change. While we've got that change there, let's now try to switch branches back to our master branch, checkout master, it says nope, you can't do that, because if you did it would overwrite the changes that you just made because master has something different for mission.html.
So please commit your changes or stash them before you can switch branches. This is a classic case of when we want to use stash. It's not the only time you can use it, you can use it any time you want to just take some stuff and shove it in a drawer. But this is the time that you'll probably use it most often when you need to switch branches, you have some changes, you're not quite ready to turn them into a commit yet, so we've got stash them instead. The way that we do it is we simply say, git stash save, so we're telling to git stash that we want it to save our changes, and then we're going to provide a message.
Now there's no -m option this time, we just provide the message inside quotes. So I'm going to say that the changes "changed mission page title." Now this can be anything. This is for your benefit. This is not a commit that anyone else is going to see, so it can be a little bit sloppier perhaps. It doesn't have to have a good message the way that you should do with the commit, but it should be something descriptive that's going to be meaningful to you when you come back and look at it later and try and remember what was it that you put into the stash. So we'll hit Return, save the working directory and index state on shorten_title, changed mission page title, HEAD is now at here, swap out - for : in index.html title.
So that's the name of the commit that I'm on now, git status, and you'll see that this is clean, git log --oneline, and I'll just do a couple of lines here, and you'll see this is the commit that it's on now. So it stashes the changes and says, now you're back here at that commit. So what it actually did, after I put those changes into the stash, was it ran git reset hard HEAD, so if you remember what we talked about with git reset hard, that takes whatever is in the Repo, and puts thats into both our index and our working directory, so they're exactly the same as the commit where HEAD is pointing right now.
One note, if you did have untracked files, you can include those too, you use these include, untracked option. You can look that up in the help file if you need to. But normally this would just include things that are in your working directory, which are tracked files, because those are the things that would conflict, it would keep us from being able to switch. So that's it. That's all there is to be able to put things into the stash. Now we are going to see how we can take a look at things that are in the stash, and that's what we'll do in the next movie.
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.