#lets get the latest
git pull
#lets switch to branch and do some work
git checkout -b makeSomeBugs
#do the work commit
git add .
git commit -am "introducing some bugs"
#push this for my lazy remote friend to see
git push origin makeSomeBugs
#uh .. changes on master
git pull origin master
#do some work..
git commit -am "introducing some more bugs"
git push origin makeSomeBugs
#lets switch back to master
git checkout master
git pull
#work is done, lets merge
git merge --no-ff makeSomeBugs
git push origin
#and remove the branch to never ever see it again
git push origin :makeSomeBugs
git branch -d makeSomeBugs
Various blog sources (but they are quite old) say that branching like this in mercurial is no-go, especially with permanent branch removal…
I might have some bits wrong because I may have misunderstood the git, but assuming you’re using a recent version of Mercurial or if not, the bookmarks extension is enabled…
There’s a couple of “mental model” differences, but I think it’s pretty close. Biggest one is when you delete the bookmark. You delete it locally and then push that it’s deleted. Reversed order from what you did with git.
There’s also the question of what you use to identify the “master” head. If there was a bookmark already on the server for it (called
masterfor example) the first line would becomehg pull -B master, the first mergehg merge masterand the updatehg update -C master. Once you’ve pulled a bookmark the first time any subsequent pulls or pushes should update it without needing to explicitly mention it.