Notify a Slack channel about git merge conflicts. This could be helpful to run automatically on long-lived development branches.
Clone the repository and make the script executable:
git clone [email protected]:nickFalcone/git-conflict-bot.git
cd git-conflict-bot/
chmod +x conflicts.sh
Set up a Slack account and create a new app from scratch.
Configure the name and workspace, then Create App.
Select incoming webhooks
Be sure to activate incoming webhooks
Click Add New Webhook to Workspace
Confirm the bot name and the Slack channel the bot will post in. Then click Allow.
Copy the newly created Webhook URL to clipboard. Do not add it to files that will be tracked by git.
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
Modify the repo_path
variable to match the repository you want to check.
repo_path=~/projects/conflicted-repo/
./conflicts.sh -i development -d main
-i
incoming branch, required
-d
destination branch, required
The bot will report any conflicted files from the merge.
The script can run at scheduled intervals with crontab or Mac Automator.