• Stars
    star
    187
  • Rank 206,464 (Top 5 %)
  • Language
    Haskell
  • License
    GNU General Publi...
  • Created almost 10 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Become a conflict resolution hero

Introduction

Handling conflicts is difficult!

One useful way to handle them, is to use git's diff3 conflict style:

git config --global merge.conflictstyle diff3

And then when you get a conflict, it looks like:

Unconflicted stuff

<<<<<<< HEAD
Version A changes
|||||||
Base version
======= Version B
Version B changes
>>>>>>>

More unconflicted stuff here

Then you are supposed to manually merge the useful changes in the top and bottom parts, relative to the base version.

A useful way to do this is to figure out which of the changes (Version A or Version B) is a simpler change.

Perhaps one of the versions just added a small comment above the code section:

Unconflicted stuff

<<<<<<< HEAD
Added a comment here
BASE
|||||||
BASE
======= Version B
BASE and complex changes here
>>>>>>>

More unconflicted stuff here

One easy thing to do, mechanically, is to apply the simple change to the other 2 versions. Thus, it becomes:

Unconflicted stuff

<<<<<<< HEAD
Added a comment here
BASE
|||||||
Added a comment here
BASE
======= Version B
Added a comment here
BASE and complex changes here
>>>>>>>

More unconflicted stuff here

Now, you can run this little utility: git-mediate, which will see the conflict has become trivial (only one side changed anything) and select that side appropriately.

When all conflicts have been resolved in a file, "git add" will be used on it automatically.

Simpler case

You might just resolve the conflicts manually and remove the merge markers from all of the conflicts.

In such a case, just run git-mediate, and it will "git add" the file for you.

Installation

Recommended: Using haskell-stack

  1. Install haskell stack
  2. Run: stack install git-mediate

Alternative install: from sources

Clone it:

git clone https://github.com/Peaker/git-mediate
cd git-mediate

Option #1: Build & install using stack: stack install (make sure you installed haskell stack)

Option #2: Build & install using cabal: cabal install (make sure ~/.cabal/bin is in your $PATH)

Use

Call the git-mediate from a git repository with conflicts.

Additional features

Open editor

You can use the -e flag to invoke your $EDITOR on every conflicted file that could not be automatically resolved.

Show conflict diffs

Sometimes, the conflict is just a giant block of incomprehensible text next to another giant block of incomprehensible text.

You can use the -d flag to show the conflict in diff-from-base form. Then, you can manually apply the changes you see in both the base and whereever needed, and use git-mediate again to make sure you've updated everything appropriately.

More Repositories

1

hssophia

Haskell bindings for the Sophia key/value store
Haskell
9
star
2

lui

Purely functional Haskell user interface
Haskell
9
star
3

cthreads

Simple light-weight user-level threads in C
C
7
star
4

small_hash

A small and flexible hash table
C
7
star
5

FreeTypeGL-old

Bindings for the freetype-gl library
C
6
star
6

gravity

Solar system simulation (transliteration from Python)
Python
5
star
7

TraceUtils

Add functions that should have been in Debug.Trace
Haskell
4
star
8

haskgame

Haskell game library
Haskell
4
star
9

git-jump

A git-jump command that can safely replace reset --hard to jump to a new git hash
Haskell
4
star
10

chess

A Chess UI (CLI and GUI) written in Haskell
Haskell
3
star
11

keyvaluehash

Hash-based key/value store
Haskell
3
star
12

mlist

Monad-list: An alternative to Iteratee
Haskell
3
star
13

vtywidgets

vtywidgets
Haskell
2
star
14

vector2

A simple Vector2 module with useful instances
Haskell
2
star
15

AlgoWMutable

Yet another Haskell extended Algo W implementation, with mutability in ST
Haskell
2
star
16

datastore

Haskell data store
Haskell
2
star
17

slidingmax

Sliding Maximum implementation (ST monad)
Haskell
2
star
18

FTGL

FTGL Haskell bindings
Shell
1
star
19

pyun

Python Pune implementation with network support
Python
1
star
20

breakout

Breakout
Haskell
1
star
21

precisefrp

Arrow-based FRP
Haskell
1
star
22

irc-conduit

Haskell
1
star
23

bindings-sophia

Low-level bindings for the sophia key/value store
C
1
star
24

filteredit

Haskell
1
star
25

hake

Haskell make
Haskell
1
star
26

treeedit

Tree Editor based on vtywidgets/datastore
Haskell
1
star
27

carttree

Filiba requested a transliteration of his blog post (jest or not!) at http://tomerfiliba.com/blog/Cartesian-Tree-Product/
Haskell
1
star
28

MapManyToOne

Bidirectional mapping of keys to shared values
Haskell
1
star
29

alice_personal_pascal

Alice: The personal Pascal by Brad Templeton
C
1
star
30

trie

trie stuff
Haskell
1
star
31

datastore-vtywidgets

Haskell
1
star
32

xmonad-dotfiles

My xmonad configuration
Haskell
1
star
33

covidmodel

Modeling covid numbers with social circles
D
1
star
34

dwarfadt

High-level wrapper for the dwarf library
Haskell
1
star
35

bitmap

Git copy of Hackage's bitmap package
Haskell
1
star
36

keyboard

Haskell Keyboard package to allow conversion between different user input packages
Haskell
1
star
37

haskell-intro

Intro to Haskell
Haskell
1
star
38

non_deterministic_parser

Example composition of the Parser and Non-determinism monads
Haskell
1
star
39

vty-keyboard

Vty keyboard descriptions adapter to the canonical keyboard representation
Haskell
1
star
40

conduit-chatserver

Simple chat server (To learn some conduits)
Haskell
1
star
41

eithert

EitherT monad transformer
Haskell
1
star
42

EnumContainers

Enum-based wrappers for standard int-containers
Haskell
1
star
43

ghczdecode

Decode Z-encoded strings of GHC
Haskell
1
star
44

word_iterator

An example word iterator in C
C
1
star
45

matrix

A little matrix in C example
C
1
star
46

timestamp-subprocess-lines

Run a subprocess and timestamp its stdout/stderr lines.
Haskell
1
star
47

extractelf

Extract an ELF file's metadata and sections into simple files
Haskell
1
star