How should I check any git commit done in remote git branch and generate an email after any code is checked in to remote repository while working on local branch so that any merge conflict can be avoided.
3 Answers
The most git
-oriented solution to "send an email when commits are added to the remote" would be a post-receive
hook. (https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) This runs each time someone pushes refs to the remote.
However, depending on how your remote is hosted, you may or may not have access to run hooks. Some hosting solutions do offer their own alternatives to hooks, so you'd have to consult the relevant documentation.
Taking a step back, though - why do you think knowing that someone has pushed to a branch is going to enable you to avoid merge conflicts? It may make you aware a little sooner when you're going to have them, but that's about the best that can ever be done.

- 42,148
- 4
- 35
- 52
You can connect your repo with Zapier. They provide connectors for both Bitbucket, Github, Gitlab and you can trigger multiple tasks with them, like email etc.

- 6,187
- 1
- 31
- 45