If you don't want to merge, you can just git fetch yourremote/yourbranch , the remote / branch specification is usually origin/master . You can then analyze the output of the command to see if new commits are actually present. You can refer to the most yourremote/yourbranch commit to both yourremote/yourbranch and symref FETCH_HEAD .
Note: I was reminded that FETCH_HEAD refers to the last branch that was selected. Therefore, you cannot rely on git fetch yourremote on git fetch yourremote at FETCH_HEAD , as the former selects all monitored branches, so the latter may not refer to yourbranch . Besides,
- you end up getting more than necessary.
- also refer to Jefromi's answer for viewing, but not uploaded changes.
- The following are not necessarily the most compact formats, just readable examples.
Here are some options for checking for remote branch updates, which we will denote with yourremote/yourbranch :
0. Error handling in the following operations:
0.1 If you try git fetch yourremote and git git fetch yourremote error like
conq: repository does not exist.
probably means you don't have this deleted row. Check your given remote lines with git remote --verbose , then git remote add yourremote yourremoteURI as needed.
0.2 If git gives you an error like
fatal: ambiguous argument 'yourremote/yourbranch': unknown revision or path not in the working tree.
which probably means you don't have yourremote/yourbranch locally. I will leave it to someone more knowledgeable to explain what it means to have something deleted locally :-), but they will only say here that you should eliminate this error with
git fetch yourremote
after which you can successfully execute the desired command. (If you correctly defined git remote yourremote : see the previous item.)
1. If you need detailed information, git show yourremote/yourbranch and compare it with the current git show yourbranch
2. If you want to see the differences, git diff yourbranch yourremote/yourbranch
3. If you prefer to compare only the hash, compare git rev-parse yourremote/yourbranch with git rev-parse yourbranch
4. If you want to use the log to return, then you can do something like git log --pretty=oneline yourremote/yourbranch...yourbranch (note the use of three points).