This question already has an answer here:
- How do I use vim as a diff tool? 6 answers
I need to repeat the following workflow multiple times:
- I have a repository with two branches
- I need to work simultaneously with two revisions of the same file, each revision belonging to one of the branches:
- I need to be able to see the differences by using diff mode
- I need to be able to make changes in each version
I'd like to know what approach should I use and what eventually useful vim plugins could help me. I did not mention the version control on purpose because I'd like some version control agnostic suggestions: I need to do this in repositories handled by misc vcs tools - at least git, fossil and darcs.
Edit: adding what I have in mind now (and what I don't really like, hence looking for better suggestions)
I could make two clones of the repository, check out needed revision from first branch in one, check out other needed revision from second branch in another repository. Then just use
vimdiff /full/path/to/file/in/first/repo /full/path/to/file/in/second/repo
But to me this looks like too much being done outside of vim
Ideally I'd probably like a vim plugin that understands many different version control repository formats and can do this workflow for me behind the curtain, so I only pass revision1, revision2, filename to it (inside vim) and I can get a vimdiff window with two versions of the same file so I could work on them.