Skip to content

Lets you check if given branches would produce a conflict when attempting a merge or rebase

License

Notifications You must be signed in to change notification settings

meeh0w/conflicted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conflicted

Use this package to check if two given references (HEAD, branch name, commit hash, etc.) would produce any conflicts on a merge or rebase attempt.

Usage

npm i --save conflicted

JavaScript API:

const { conflicted, mergable } = require('conflicted');

if (mergable('master', 'feature/branch')) {
  console.log('no conflicts!');
} else {
  console.log('conflicts');
}

// or

if (conflicted('master', 'feature/branch')) {
  console.log('conflicts!');
} else {
  console.log('no conflicts');
}

in a bash script:

Make sure to install conflicted globally to use it as a CLI command (npm i -g conflicted).

#!/bin/bash

if conflicted master feature/branch
then
  echo conflicted
else
  echo mergable
fi

in npm scripts:

{
  "scripts": {
    "postversion": "mergable HEAD master && echo mergable"
  }
}

TODO

  • tests

About

Lets you check if given branches would produce a conflict when attempting a merge or rebase

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published