Wikipedia:Merging templates

Introduction
Merging templates is one of the most complex operations on Wikipedia. It is technically demanding, and also comes with issues of Attribution. While in some cases, Templates can only be edited by Template editors, in most cases, any user can endeavour to merge templates. Due to the complexities involved, it is strongly recommended to consult with an experienced editor before making such an attempt.

Considerations
Due to the nature of templates, any change you make to the template will be reflected on many different pages. In the case of widely used templates, the task of updating pages is often delegated to the Job queue. As a consequence, the change can take days to fully propagate across all pages using a template. This means that a bug in an unusual template use case (such as one that does not appear in the TESTCASES) can take a long time to appear, making it difficult to track the bug back to a change.

Attribution of the template being merged is also an issue. If functionality from the template being deleted is moved into the target template, then the copyright status of the merged functionality must be considered. Consequently, the guidelines described within Copying within Wikipedia need to be observed.

Consensus
Consensus to merge templates is generally obtained at WP:TFD. The factors considered at this point largely encompass the feasibility and desirability of merging the templates. If the functionality of the two templates overlaps considerably, then they're a good candidate for merging. For example, Template:Infobox UK place was built as a replacement for Template:Infobox England place and similar templates for the other countries in the UK, and the relevant TfD is instructive.

Holding Cell
Once it has been decided to merge a template, the main work begins. There is no set procedure for this. An approach to merging templates has to be the best judgement of the editors performing the merger. In particular, if there is an identical field between the two templates, merging is generally trivial. However, often a field in a template will perform the same function, but with a different name. A common example of this is place templates that include a map. Sometimes, the map name is provided as pushpin_map, as at Template:Infobox Settlement, sometimes location_map, as at Template:Infobox laboratory. Any merger between such templates would require invocations of this parameter to be switched. Often, a Bot is written for this purpose. Finally, if a function exists in the template being merged, but not the target template, it often should be merged into the target. This is where attribution is required.