![]() Now if I take a look, you see, it looks like the same files, the same folders and same files, but if we were to drill down deeper and take a look at the contents of those files and those projects you'd see they're changing as I'm going through the course. I typed in the wrong branch, so you see I got this error, pathspec does not match any files known to git, so that's because I made a typo. Oops, I forgot the word check, I forgot the word git, checkout 04-04. So we'll do a git branch -a to see em all. So you see, when you switch branches, it changes the state, now I have a different set of files. Now you see that I have some sub-folders, DebugConsole, DebugWpf and RobotNameGenerator, and if I drill down, like this, you can see I've got some CS project files in there, those are just C# projects, and I've got a CS file, which is some code file, and I've got a couple of text files. Now let's see what happens when I switch to checkout 01-01 and then do a dir. Similar to the commands above, you can access this function by pressing Ctrl + X, then G. This means that you can easily create and move between a repository’s branches from within the program. So what does this imply for the files? Remember that if I do a dir, here, I'm in the source folder, I only have these two files. Creating and Switching Git Branches Another brilliant feature of Magit is the ability to manipulate Git branches. Pull changes in master (like: git checkout master git pull git checkout. How would you do that? Git checkout master, and then we'll do a branch to see that we're back on master. Create a new branch in live ( git branch live ). The green tech shows me that I am on that branch, and then it shows that I also have the master branch available to switch back to master. I am currently on 01-01, that's what the asterisk means, that's where the head is pointing. And now if I do git branch, again, like this, it shows that I have two branches I've checked out. It tells me a switch to a new branch, and it's also telling me it's set up to track the remote branch from 01-01, from origin. ![]() So let me clear the screen, first, and then I'll type in git checkout, and then I need to tilt the name of the branch, 01-01. So I would like to switch to branch 01-01. ![]() Now I can see all their branches are available to me by typing in git branch -a, and all the ones that are in red are in the repository, but I haven't checked out any of those yet so they're not listed as local. So I'll type in git branch, and this tells me that I've only checked out one branch so far, and I'm currently on that branch called master, that's in green text here. First of all, let's take a look at which branch I am currently got checked out on my local computer. I've cloned the repository to the local folder, and I would like to switch to another branch. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |