git pull
(or rather, the git merge
part that pull
does) will "solve" both 'ahead' and 'behind'.
branch is X commits behind means that there are X new (unmerged) commits on the branch which is being tracked by your current branch.
branch is X commits ahead analogously means that your branch has X new commits, which haven't been merged into the tracked branch yet.
Once you've pulled (thereby merging the remote changes into your local ones) and pushed (thereby publishing your changes and the merge to the remote), your own branch and the remote branch will point to the same commit, so neither is ahead or behind.