Giter VIP home page Giter VIP logo

kakmerge's Introduction

kakmerge

kakmerge is a merge tool for Git that spawns instances of Kakoune within a tmux session.

When invoked, the script splits the current pane in four and displays information necessary to perform a 3-way merge (local version, remote version, ancestor and merged result).

3-way merge with kakmerge

Configuration

Place the kakmerge script into a directory of the $PATH.

Run the following commands to configure git:

git config merge.tool kakmerge
git config mergetool.kakmerge.trustExitCode true
git config mergetool.kakmerge.cmd "env LOCAL=\"\${LOCAL}\" BASE=\"\${BASE}\" REMOTE=\"\${REMOTE}\" MERGED=\"\${MERGED}\" kakmerge"

Make sure to have a look at the mergetool git configuration to fine tune it.

Testing

You can test kakmerge on a demo 3-way merge by using the test.sh script provided in this repository.

Commands

Several commands are available in a merge session, to simplify the merging process:

kakmerge-search: search for the contents of the main selection in all clients

kakmerge-abort: discard the current merge

kakmerge-done: validate the current merge

kakmerge-pick: pick a version of the code from one of the three versions of the buffer

kakmerge-next-conflict: jump to the next conflict in the merge buffer

Make sure to read the onboard documentation of the commands for more specific description of the commands.

Usermode

The kakmerge usermode is available in merge sessions, and maps to all the commands that do not take any argument (c.f. above).

kakmerge's People

Contributors

lenormf avatar maximbaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kakmerge's Issues

Release a `v1.0`

Start versioning to keep track of bugs fixed and features implemented in kakmerge itself, but also keep up with upstream changes in Kakoune.

Still Accepting Pull Requests?

Since this project hasn't seen any activity for over two years, I wanted to know if you would still consider pull requests against this repository. If so, then I have some ideas of how to support WezTerm and non-POSIX-compliant shells (currently the mergetool.kakmerge.cmd command fails for shells such as fish and xonsh). If not, then I'll just fork it and maintain that fork, no big deal.

git config option merge.tool set to unknown tool: kakmerge

I'm running macOS 11.1 and I'm getting this error:

~/g/kakmerge on  mastersh test.sh
Created temporary directory: /var/folders/7w/jr1m8lhx12sfmydz5b7gklrw0000gn/T//kakmerge-test-kYntjw
Leeres Git-Repository in /private/var/folders/7w/jr1m8lhx12sfmydz5b7gklrw0000gn/T/kakmerge-test-kYntjw/.git/ initialisiert
[master (Root-Commit) 8a3fcc2] Initial commit
 1 file changed, 9 insertions(+)
 create mode 100644 animals.txt
Zu neuem Branch 'octodog' gewechselt
sed: 1: "animals.txt": command a expects \ followed by text
Auf Branch octodog
nichts zu committen, Arbeitsverzeichnis unverändert
Zu Branch 'master' gewechselt
sed: 1: "animals.txt": command a expects \ followed by text
Auf Branch master
nichts zu committen, Arbeitsverzeichnis unverändert
Bereits aktuell.
git config option merge.tool set to unknown tool: kakmerge
Resetting to default...

This message is displayed because 'merge.tool' is not configured.
See 'git mergetool --tool-help' or 'git help config' for more details.
'git mergetool' will now attempt to use one of the following tools:
opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare smerge emerge vimdiff nvimdiff
No files need merging

Feature request: pick only one conflict

When I tried it for the first time, I instinctively assumed that kakmerge-next-conflict and kakmerge-pick work in tandem — you jump to a conflict, select which version you prefer and jump on the next one. Currently kakmerge-pick replaces all conflicts with the selected version, until I read README I thought I'm experiencing a bug.

Can we have kakmerge-pick resolve one conflict and kakmerge-pick-all resolve all conflicts?

no tmux session/window is spawned

I've configured test repo like this:

[merge]
	tool = kakmerge
[mergetool "kakmerge"]
	trustExitCode = true
	cmd = env LOCAL=\"${LOCAL}\" BASE=\"${BASE}\" REMOTE=\"${REMOTE}\" MERGED=\"${MERGED}\" kakmerge

Invoking git mergetool spawns no new tmux session or window.
I'm on macOS, iterm2 and tmux v3.1c

Use kakmerge for stand-alone diffs as well?

Sometimes you need to merge two files outside the context of a git merge - (Using pacdiff on an Arch Linux machine to handle .pacnew files for instance).

Right now it give the following error message:

The required environment variables exported during a merge are missing

I'm wondering if this is a use-case you intent to support?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.