AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Tortoisehg diff between branches7/29/2023 and she would've needed to commit her current work to default (or revert it)(or commit it to a different new branch, I guess), before proceeding. If she had some local uncommitted work (or uncommitted merges) she would've gotten one of these two error messages:Ībort: crosses branches (merge branches or use -clean to discard changes) How do we switch to the branch of our choice? We update to it.Ĥ files updated, 0 files merged, 0 files removed, 0 files unresolved If you haven't branched, then you are in the "default" branch. If she's unsure what branch she's currently on, she can easily check: Now Veronika has your code on her machine, but not in her working folder, as she hasn't ' update'd yet. She can see that the repository now has two heads (the default branch, which she last worked on, and your new branch)Īdded 1 changesets with 1 changes to 1 files (+1 heads) Now, your comrade Veronika is helping you weaponise space, as she is a specialist in weapon targeting systems. But it is an OK thing to do, if you want someone else to help you with your work, so let's use the new-branch option:Īdded 1 changesets with 4 changes to 4 files maybe you wanted to finish working on that feature before you pushed it? Mercurial won't let you accidentally push out a new branch. (use 'hg push -new-branch' to create new remote branches) When you try to push your work, let's see what happens.Ībort: push creates new remote branches: WEAPONISE_SPACE! > hg commit -m "Adding a small laser to the space shuttle" Now when you commit, you will be committing on that branch: You just need to decide before your first commit. The beautiful thing here is that you didn't need to create the branch before you started writing code. If you do regret the ' hg branch ' command, then it can be immediately undone with ' hg branch -C' (or ' hg branch -clean'). (branches are permanent and global, did you want a bookmark?)Īnd obviously, if you are brave enough to weaponise space, you are brave enough to create branches that are permanent and global. Marked working directory as branch WEAPONISE_SPACE A branch is a nice place to perform your work, away from the boring, safe work the rest of your team are engaged in. Let's say you are working on a feature called WEAPONISE_SPACE, and you don't want to accidentally release it before the public have been warned. Now, as you are working you realize that you want your current work to be put into a branch, to keep it out of harm's way. Maybe you created it (with ' hg init') or you copied it (with ' hg clone'). I don't know or care how you got the repository. Our story begins, some happy day, when you are working very hard, in an existing repository. If you're unsure about anything, simply test it for yourself. This is my basic guide to branching (I'm a basic kind of person) and it's based on a short email I wrote myself a long time ago, which I still occasionally rely upon. I've written a bit about mercurial over the years, but never once mentioned branching.
0 Comments
Read More
Leave a Reply. |