It is not possible to stop git processing before a pull request and take a user input. I mean, it is possible, but for that you will have to make a few changes to git and build it from source. I am not going down this path.
There is a nifty little trick to use conditional statements within git hooks. You can use Ruby (or any other language) within a git hook to make it conditional. This works best in a pre-commit
hook or a hook that is invoked before any actual processing happens. In case of a git pull
, the only hook you can latch on to is the post-merge
hook and that too is invoked only after the entire processing is done. So, there is no point really asking the user if they want to merge another branch after the branch is merged, right :) However, you can show them a message.
For this, use something like:
#!/usr/bin/env ruby
branch=$(git rev-parse --symbolic --abbrev-ref $1)
if branch != $GIT_DIR/ORIG_HEAD
puts "You merged a different branch dim wit"
end
Now, what I am trying to do is compare if the merged branch was the same as the original branch name and if not, show the user a message. This will appear as remote
on your git merge summary.
Again, am not sure if this will work, cause I am not really sure if git rev-parse --symbolic --abbrev-ref $1
will give you the branch name.
This is again, just a suggestion, not a solution to your question :(