So I am making a script that fetches the latest tag from the main remote repository and merges it into my local repos with my custom changes, for about 10-20 repos, in a single script. The merge part looks something like this:
git fetch -q https://android.googlesource.com/platform/$REPO_PATH $TAG
git merge -q --no-ff FETCH_HEAD
if [ $? -eq 0 ]; then
echo -e "$REPO_PATH merged succesfully"
else
echo -e "\n$REPO_PATH has merge conflict(s)\n"
fi
The point of this is that I want to know which all commits merged succesfully (and needs a push to my custom git). But sometimes the repos are already up to date (i.e. a new tag in the remote repo without any new commits), and in that case the "merged succesfully" message shows even though nothing has really been merged.
I only want to know which all repos underwent a merge and needs pushing to my git, and also want to know which all have merge conflicts (this works fine in my script though). All I have noticed is that when git does a real merge, it opens up nano asking for the commit message. But I have no idea how to detect merges using that. Thanks in advance.