It looks like your story looks like this:
...---o---A---o---...---o---o---B master \ o---o---...---o---C verydifferentbranch
You say you worry about losing history if you click on a verydifferentbranch on master . Such an operation effectively discards everything after A and up to B
You can save the story by combining it, or simply drop the tag on the abandoned tip of the branch and leave it unaided.
Use merge
Merging will allow you to save both sides of the story:
...---o---A---o---...---o---o---B \ \ o---o---...---o---C---M master
The type of merge you make will determine the content created for fixing M. Normal merging (using the merge strategy recursive ) looks like there will be a lot of conflict in your case. If you really need to enable the changes from the A..B commit, you have nothing more to do but work through conflicts represented by either merging or rebase. (In the future, you will probably have fewer problems if you can combine or reinstall more often to deal with conflicts as they arise.) But if you just want M have the same content as C (i.e. . you want to ignore the changes presented by A..B ), you can use ours merge strategy.
git -merge (1) describes our merge strategy:
This allows any number of goals, but the resulting merge tree always refers to the current branch branch, effectively ignoring all changes from all other branches. It is intended to replace the old history of the development of the lateral branches. Note that this is different from the -Xours option for a recursive merge strategy.
You can create an M with the message Merge commit 'abandoned/foo-features' as follows:
git tag -m 'describe reason for abandonment here...' \ abandoned/foo-features master
Variations of these commands will give you slightly different auto-commit messages for M (you can always specify your own git merge -m or change it with git commit --amend ).
The main thing is that the resulting master will have both parts of the history, but not one of the changes from the original side of the master (these changes are still in the history, they simply are not presented in the tree to which reference is made by fixing M ).
Leave it hanging
If it is permissible to “rewrite” master (that is, there is no other work based on any A..B A..B , or the involved users do not mind the work that it performs in recovering from overwriting ), then you can simply leave the tag on current end of master and replace master with a verydifferentbranch .
...
Put it this way:
git tag -m 'describe reason for abandonment here...' \ abandoned/foo-features master