Skip to content

nickFalcone/git-conflict-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git conflict Slack bot 🤖

Notify a Slack channel about git merge conflicts. This could be helpful to run automatically on long-lived development branches.

Install

Clone the repository and make the script executable:

git clone git@github.com:nickFalcone/git-conflict-bot.git
cd git-conflict-bot/
chmod +x conflicts.sh

Set up Slack

Set up a Slack account and create a new app from scratch.

Configure the name and workspace, then Create App.

new

Select incoming webhooks

incoming webhooks

Be sure to activate incoming webhooks activate

Click Add New Webhook to Workspace

add new webhook

Confirm the bot name and the Slack channel the bot will post in. Then click Allow.

allow

Copy the newly created Webhook URL to clipboard. Do not add it to files that will be tracked by git.

copy webhook

Endpoint

Create the endpoint.txt file with the following command using your copied Webhook URL. This file will not be tracked by git.

echo -e "https://hooks.slack.com/services/your/hook/here" >> endpoint.txt

Set repository path

Modify the repo_path variable to match the repository you want to check.

repo_path=~/projects/conflicted-repo/

Run

./conflicts.sh -i development -d main

-i incoming branch, required -d destination branch, required

Results

The bot will report any conflicted files from the merge.

report

Automate

The script can run at scheduled intervals with crontab or Mac Automator.