There are ways to get around this (namely, stashing and commit amending) that we’ll cover later. It’s best to have a clean working state when you switch branches. However, before you do that, note that if your working directory or staging area has uncommitted changes that conflict with the branch you’re checking out, Git won’t let you switch branches. All you have to do is switch back to your master branch. With Git, you don’t have to deploy your fix along with the iss53 changes you’ve made, and you don’t have to put a lot of effort into reverting those changes before you can work on applying your fix to what is in production. Now you get the call that there is an issue with the web site, and you need to fix it immediately. The iss53 branch has moved forward with your work. $ git commit -a -m 'add a new footer 'įigure 3-12. Doing so moves the iss53 branch forward, because you have it checked out (that is, your HEAD is pointing to it see Figure 3-12): $ vim index.html You work on your web site and do some commits. This is shorthand for: $ git branch iss53įigure 3-11. To create a branch and switch to it at the same time, you can run the git checkout command with the -b switch: $ git checkout -b iss53 To be clear, Git isn’t tied into any particular issue-tracking system but because issue #53 is a focused topic that you want to work on, you’ll create a new branch in which to work. You’ve decided that you’re going to work on issue #53 in whatever issue-tracking system your company uses.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |