Using the list as reference, choose the branch you want to checkout. Notice that it lists both the branches that are local and the remote branches on Bitbucket. You should see something similar to the following: Then, do the following:Ĭhange to the root of the local repository. On your local system, make sure you have a local repository cloned from the remote repository. Using Git to checkout a branch on the command lineįor the purposes of these steps, will refer to the name of your branch. Open the terminal on your local machine and change to the root directory of your repository.Īt the command line, enter the copied command from Bitbucket and press ENTER. Press the Check out button to display the appropriate check out command.Ĭopy the command (or choose Check out in Sourcetree if you'd rather use Sourcetree). In the repository's Branches, click the branch you want to checkout. If you're using Sourcetree, Bitbucket gives you a single button checkout. The Bitbucket interface gives you the basic command for checking out a branch. When you checkout a branch, you should already have a local clone of the parent repository. If you plan to use branches a lot or want to know more, we recommend you learn more by visiting a site or buying a book devoted to the DVCS you are using (Git or Mercurial). It merely provides a pointer to help you understand how Bitbucket supports branches. The information on this page is not a definitive guide for either Git or Mercurial. If any are found, investigate them before deploying.Branching is an advanced technique. In addition to that, I'd strongly recommend you check for local modifications using git status before the deployment. That way, you'll get exactly the files from MY_VERSION_TAG. The merge will cause you to have an (untested) mix of data from different branches. Master (by running git pull origin master)Įven if you insist on using Git for deployment, it is not a good idea to use git pull, because git pull will automatically perform a merge if the wrong branch was checked out before (or if you even have local commits, which you hopefully don't). Then, on the production box, we fetch and merge the latest version of If you really, really feel you must, you can always create and checkout a branch later when you need to (but please don't). I'd actually see it as a benefit, as it makes it clear you are not supposed to commit things on production. I really hope you are not implying that you intend to commit (and possibly even develop) hotfixes on production? If yes, then please don't :-).Īnyway: Yes, the detached HEAD state should not be a problem. State but I don't really see an issue with that, except for when I'm aware that running with a tagged version will do so in a detached If a tag is checked out, nothing will change.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |