Every time you make a commit in a DVCS you are technically making a branch in the history, every time you push it back to the blessed repository you integrate it back, here comes the interesting part:
- If no one made a change during your commit, it won't look like a branch in the DAG (directed acyclic graph)
- If someone else made a change during your commit, it will look like a branch in the DAG, only unnamed
Remember the "fork" button in Bitbucket/github?, forking can be regarded as a synonymous of branching, and what the "fork" button does is just a clone of that repository to your account.
The only advantage of "cloning to branch" is being able to work simultaneously at two points in the history, and ironically for your coworker, it is a common workflow for working on different branches at the same time (without having to go back and forth).
Tell your coworker to learn how to branch, it is very easy, here, have a tutorial:
D:\>mkdir lol
D:\>cd lol
D:\lol>hg init
D:\lol>hg branch
default
D:\lol>touch lol
D:\lol>hg add lol
D:\lol>hg commit -m "lol"
D:\lol>hg branch lol
marked working directory as branch lol
(branches are permanent and global, did you want a bookmark?)
D:\lol>hg branches
default 0:35d562fafaf2
D:\lol>echo "lol" > lol
D:\lol>hg commit -m "New lol branch"
D:\lol>hg branches
lol 1:9384f923e78d
default 0:35d562fafaf2 (inactive)
D:\lol>hg branch
lol
D:\lol>hg update default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
D:\lol>hg branch
default
D:\lol>hg update lol
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
D:\lol>hg branch
lol
D:\lol>hg update default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
D:\lol>hg branch
default
D:\lol>hg merge lol
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
D:\lol>hg commit -m "lol merge"
D:\lol>hg branch
default
D:\lol>hg update lol
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
D:\lol>hg branch
lol
"Cloning to branch" makes sense when you are working in different branches at the same time, or, when you want to try out an experiment without creating a permanent branch in the history and still be able to integrate it back to an already existing branch.
I personally don't like this practice and prefer to do branches and close them if necessary. Here, this is how you do it:
D:\lol>hg branches
default 2:46420aca1612
lol 1:9384f923e78d (inactive)
D:\lol>hg branch
lol
D:\lol>hg commit --close-branch -m "Obai, glorious lol branch"
D:\lol>hg branches
default 2:46420aca1612
D:\lol>hg branch
lol
D:\lol>hg update default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
D:\lol>hg branches
default 2:46420aca1612
D:\lol>hg branches --closed
default 2:46420aca1612
lol 3:4b79c577e029 (closed)
Hope this clears out your DVCS branching doubts, here branches are not scary anymore.
git
works. Withhg
this is usually the first workflow taught and it is still a very useful one.