Q:

GIT log shows ALL previous merges as ahead when it's not

So, I have the master branch and a uat branch. All codes changes are on master and then, when ready to roll out to the server, are periodically merged from master into the uat.
I'm using GitX, and notice that my uat branch is starting to show a branch line for each merge to uat; instead of the expected two branch lines of master and uat.

If I push my changes to origin/master the lines above change to show the expected 2 lines.  If uat is then pushed, it goes back to what you see. 
At first I thought this was a GitX quirk, but my GIT states that my uat is 11 commits ahead when master was just merged into uat.  If I count the number of extra branch lines, it matches the 11 merges.
So I'm starting to think that I had a random detached head or something somewhere that's made things so astray, as one of these merges has master instead of refs/heads/master and another a detached head.
Was wondering if anyone knows what this is, and if anything should be done to clean it up before it gets out of control.
Appreciate any help

A:

Please check the tracking branch for uat by git branch -vv.
If uat is not tracked by origin/uat, you can set git branch --set-upstream-to=origin/uat uat.
Then when you use git status, it will show the right status between local uat branch and origin/uat.
Such as if you merge master into uat without pushing to remote, git status will say 1 commit ahead of origin/uat. After pushing uat to remote, and git status will say your local uat is up-to-date with origin/uat.

