If Git suddenly popup a warning, “branch is ahead by x commits”.
You can do the following
Switch to the branch, e.g it’s the Master branch
git checkout master
Then, use Git Fetch to update the local copy of a remote branch
Git fetch is similar to pull, except it won’t do any merging