1

My teammate has pushed some code changes on the git repo but when I use the command git log, I cannot see his commit in the commit history. I can view it only when I pull the code. Is there a way to see all the commits made by everyone without pulling the code using git pull.

rdp
  • 2,072
  • 4
  • 31
  • 55
  • Duplicate of [git log command to check for commit history on remote server](http://stackoverflow.com/questions/13941976/git-log-command-to-check-for-commit-history-on-remote-server). –  Apr 03 '14 at 22:56

3 Answers3

1

You need to check the log on the remote repository instead of your local using git log remote remotename/branchname. For example:

git log remote origin/master
Community
  • 1
  • 1
gerrytan
  • 40,313
  • 9
  • 84
  • 99
  • `git log remote` isn't an actual git command. There is a `git log --remotes` flag, but that won't make a network operation to find out if the remote has new commits. You still need to fetch or pull first. –  Apr 03 '14 at 22:52
1

To see what commits have been added to the upstream , you can run a git log using branch with the following commands:

git log origin/<branch>

More info: https://www.atlassian.com/git/tutorial/remote-repositories#!fetch

Chofoteddy
  • 747
  • 9
  • 22
  • The original poster is asking if there is a way to view new commits on a remote without having to fetch or pull. Your answer still requires a fetch or pull if there are new commits, so it doesn't really solve the problem. –  Apr 03 '14 at 22:55
1

The original poster asks:

Is there a way to see all the commits made by everyone without pulling the code using git pull.

The answer is no. In order to see a log of the newest changes on the remote repository, you must fetch or pull those changes first:

git fetch origin
git log origin/master

Or

git checkout master
git pull origin master
git log origin/master