Currently, I will focus on how to request user confirmation before any click is performed.
Unfortunately, because there is no such thing as a pre-pull hook , I don’t think you can get the actual pull to do this right for you. As I can see, you have two options:
1 - use fetch , then merge (instead of pull )
Instead of running git pull run git fetch , then git merge or git rebase ; breaking the pull into two steps, of which it naturally consists, will force you to double-check that you are going to combine / remake into what.
2 - Define an alias that asks for confirmation before clicking
Define and use a pull wrapper (as an alias of Git) that asks for confirmation if you try to retrieve from a remote branch whose name is different from the current local branch.
Write the following lines to a script file called git-cpull.sh (to confirm, then press) in ~/bin/ :
Then define an alias:
git config --global alias.cpull '!sh git-cpull.sh'
After that, if, for example, you run
git cpull origin master
but the current branch is not master , you will be asked to confirm before any pull is executed.
Example
$ git branch * master $ git cpull origin foobar Are you sure about this pull?n $ git cpull origin master From https://github.com/git/git * branch master -> FETCH_HEAD Already up-to-date.
source share