0

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.

Twinkle
  • 3,431
  • 2
  • 9
  • 5

3 Answers3

1

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.

Mark Adelsberger
  • 42,148
  • 4
  • 35
  • 52
0

Maybe what you are looking for, was answered here?

If you are you using anything like github or gitlab there are settings to configure this and manage your commit-hooks.

ChrisN
  • 74
  • 3
0

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.

gazdagergo
  • 6,187
  • 1
  • 31
  • 45