![]() And once again, it's telling me that the file has been modified, I want to click on Yes, I see the change. So I can see what has changed when I pull the items out of the stash. So when I popped the stash, it ran get status for me. Your branch is up to date, there are some changes that are not staged for commit, it's Robot.cs, and if I call git status again, you see that same message. So I will do git stash pop and do you notice that it says, this is the same message we saw earlier. And now I want to get the items out of the stash. I work in this branch for a while, or look at the code in here and then I want to switch back to branch 02, I was successful at that. Now I will clear the screen and then I will use the up arrow to try this checkout again. Now that I've done that, I can successfully switch branches. I made some changes, I stashed the changes that reverted all the files in that branch to their original state. So I click on Yes, and I see that it returns to the original state. Now let's go back to that text file, that code file and over here in notepad , it tells me that that file has been modified. It tells me it saved my working directory and index state on 04-02. So I'll clear the screen and then I'll type in, git stash, it's that simple. Now, if I was working on a normal software project and I wanted to persist these changes, so I can merge them later, I would stage the files and then I would commit the files but that's not what we're doing here, we're working in some training videos and some training code, and I just want to switch branches and I've made some changes and I just want to stash them for later. And it's telling me here that the changes are not staged for commit. ![]() That says, that there's one modified file. I can also verify this another way by calling git status. In this video, we'll look at the stash command and later we'll look at the commit command. It's telling me that changes are in Robot.cs and then it's telling me there's two choices, commit your changes or stash them before you switch branches. And I get an error, Your local changes to the following files would be overwritten by checkout. And over here, I'll attempt to check out the other branch. I'll change the tab Buffer string to an asterisk, like that and then I'll save the changes. It's this file Robot.cs and I'll make a change to line 22. So first of all, let's go and look at the code file. Some of these changes may also be staged in the index.- The scenario for this video is I'm on this 04-02 branch and I'd like to switch to another branch in the chapter but I have modified the contents of one of the files while I was working on the code and that's going to prevent me from switching to the other branch. How git stash encodes your worktree and index as commits:īefore stashing, your worktree may contain changes to tracked files, untracked files, and ignored files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |