Reputation: 19279
Given a branch called 'main'. As a developer wanting to work on a new feature, I create 'f1' and do several commits, pushing regularly to our central repo. While working on the feature, I need to get the changes form 'main' in my branch.
I know I can hg merge main
to get the changes in 'f1'. But when I later integrate in 'main' then the history will be full of references to that temporary branch. Are there ways to make my branch work less visible after the fact?
Upvotes: 1
Views: 104
Reputation:
First of all, why do you worry about that the main branch would contain the history of the f1 branch after merging the latter to the former, if the f1 branch is already in the central repo??? The f1 branch is not temporary/disposable/invisible any more once it's pushed into the central repo, it's very visible to everyone who can access the central repo.
The answer to your question is: No way unless f1 is a by-cloning branch. All suggestions of using bookmark and/or anonymous branch are false.
Upvotes: 0
Reputation: 616
To make branch less visible in history you should use bookmarks. Let's see both cases, with a named branch or with a bookmark.
With new branch named 'f1' from 'main':
$ hg update main
$ hg branch f1
...
$ hg glog --template "{rev} {branch} {bookmarks} {desc}\n"
@ 5 main Hacking main.
|
| o 4 f1 Hacking f1.
| |
| o 3 f1 Hacking f1.
|/
o 2 main Hacking main.
|
o 1 main Hacking main.
|
o 0 default
With new bookmark named 'f1' from 'main':
$ hg update main
$ hg bookmark f1
...
$ hg glog --template "{rev} {branch} {bookmarks} {desc}\n"
@ 5 main Hacking main.
|
| o 4 main f1 Hacking f1.
| |
| o 3 main Hacking f1.
|/
o 2 main Hacking main.
|
o 1 main Hacking main.
|
o 0 default
In the bookmark case the 'f1' feature can be removed from history with hg bookmarks --delete f1
(from Mercurial 2.3 new bookmarks are pulled by default WhatsNew) and there are two paths in the 'main' branch.
Upvotes: 1