When you commonly push something toward a repository, you usually work on a branch configured to "track" an homologous one located in the remote repository. The state of this branch is maintained locally each time you fetch the branch, either using fetch
, push', 'pull
or when you do git remote update
.
So what you simply need to do once you have committed is to compare you local branch and its remote counterpart. This will tell you if a commit has been pushed or not yet, then you can specify a file name to restrict the comparison to this sole file.
Assuming you're working on master, this will tell you if there are discrepancies in general:
git diff origin/master master [your_file]
And this one will tell you which commits are not pushed yet:
git log origin/master..master [your_file]
Here, origin/master
is the remote branch ans is on the left because it's supposed to represent the original state, master
is the local branch and immediately follows the former one because it's supposed to be the state we're reaching.