I have two notes that I realize are actually covering the same idea and I want to merge them into one note. Call them
verde. Both have linked and unlinked mentions.
Merging the content is easy. I can just move text from one to the other. But how do I merge these notes without breaking links?
Use the merge shortcut.
I’m sure there ought to be one. Right next to the split shortcut. Just like PDF editors.
I’m not sure about current practice.
I can’t think of any way to merge notes while retaining meaningful mentions to the originals. If I were you, I’d probably create the note
green and verde (or something to that effect) and include the links to
verde in it. I’d only actually merge them if their contents were very very similar.
Is it possible to:
a) combine content verde into green
b) find a replace all instances of [[verde]] with [[green]]
Besides an explicit merge function (which would be great), the above is how I would try.
Maybe this thread should switch to Feature Request
With the way the post is worded as more about process, I put it in #knowledge-management, but yes, it could be the start of a feature request.
Yeah, I think that if no good solution is forthcoming it should be taken as a feature request. Or two, because I’d want split if we had merge.
I worded this as a process question because I am currently dealing with this issue and decided to ask for advice.
I would also also love to make this a feature request. Happy to edit my original post to turn it into one or start a new one.
I’d suggest starting a new post, perhaps with more detail about how you’d expect this to work in Obsidian.
Of possible relevance to future readers of this thread, I found another post in this forum about doing global find & replace on your Obsidian vault — which could help in the task of unifying links (until a ‘merge notes’ feature comes along).
To paraphrase @akaalias’s technique for the present use case:
- Install Atom from https://atom.io/
- Open vault directory in Atom
- Use “Find” → “Find in Project”
- Find all “[[verde]]” to replace with “[[green]]”
- Replace all
- Find all “[[verde|” to replace with “[[green|”
- Replace all
To also replace all unlinked mentions of “verde”, you could Replace All “verde” with “green” instead.
There are other text editors out there that do global find/replace for a folder of files. BBEdit for instance.
I find the notion of types and tokens useful in these cases.
A type is a class and a token is an instance of the class. (If that is unintuitive, try this: A type is a set, and a token is a member of that set.) A type can itself be a token of another, higher-order type. (So
verde are tokens of
green (type), which is itself a token of
colors (type).) We can put these ideas to work in Obsidian with links, embeds, and the backlinks panel.
You could do a whole type/token hierarchical thing in Obsidian and link your notes to that, or your could add Such-and-Such (Type) records as needed with a list of links or embeds to the records with notes and have them serve as the “tokens” in this relationship. In your case, I might do something like this:
Maybe a definition or color swatches.
New notes go here
Now you can read everything in one place without messing with links on other notes. Still, after following a link to one of those embedded notes I might forget to check its backlinks panel for type/token relationships. I want to make sure that I follow links all the way to the merged note. So, let’s add some links to
Instance of (or token of, or member of):
Green (Type) (Takes me to the merged note.)
Existing notes here, as well as any new notes about
green that aren’t really about
verde. Or you can just notes to
verde respectively however you do today.
The relationships between your notes and these ideas will still be pretty apparent from the Graph View.
Simple workaround from @malecjan:
Now that there is an ‘Alias’ function I do the following:
- Choose either Green or Verde to be the primary note.
- Merge and add an Alias in the frontmatter note.
If for example I chose [[Verde]] to be the primary, I add metadata to its frontmatter:
Then I rename all occurrences of [[Green]] to [[Verde|Green]]
After half an hour of searching for the forum i’m still curious:
If i get an occasional conflict copy - is there a tool to compare line-by-line with diff side-by-side and merge those notes? What i’m missing…
When merging, I’d like to have an option for the note to be deleted to be added as an alias to the note merged into, and have original references still refer to the alias rather than refer to the now combined single page. Is that possible? Whether built in or via a plugin?
If you want to make the deleted note title an alias of the merged note, I believe this should work:
Aim: Merge (“B” + “A”) → “A”, and add “B” as an alias for “A”
- Add content from “B” (copy or cut) into “A” (paste). (You have control over the order of merging)
- Delete “B”. (links to “B” will be dead temporarily)
- Search your vault for links to B, e.g.
- Replace all occurrences with
[[A|B]] (manually or using this method)
- Add “B” as an alias for “A” in YAML frontmatter, i.e.
The workaround posted here is probably the best available option.
The problem with using a search-and-replace for [[verde]] and [[green]] is that it won’t catch any instances where the link used a custom display text. (e.g. [[verde|all things green]]
But given the software already has the ability to update links, I would think it shouldn’t be too difficult to add the ability to tell it to “make all links to (this note) point to (that note).”
Good point. I updated my search & replace instructions above to include custom display text case. I agree that the renaming workaround is a more fool-proof solution.
I’ve just discovered the Note Composer core plugin that will merge two notes together and update all links. This was first released in Obsidian 12.6.