7

I'd like to use the git log command to extract the list of changes from a repository since a given date on a specified branch.

For the purpose I found the following syntax which seems to work fine:

git log --since=2011-10-01 --branches=mybranch

The above command works fine on a cloned repository in my workstation (Ubuntu 10.04, GIT 1.7.7.2) but outputs a wrong log on the main repository from which the clone has been created. The main repository is a bare GIT repository hosted on Centos 5.5, GIT 1.7.3.4. Basically, the main repository does not show a number of the most recent commits.

I don't understand if this is the expected behavior and the difference is due to the fact that the main repo is bare, or if this is a different behavior due to the fact that the GIT version is not the same.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • And your most recent commits have all been pushed back to that remote bare repo? – VonC Nov 18 '11 at 12:35
  • Thanks for your help. I am not a committer on that repository, I just cloned it from the server to my local workstation. Tried the command in local and got a result, logged into the server via terminal, repeated the command on the same repository (no one committed anything on the server in between) and got a different result. Plus, it was the local clone to show more commits than the remote server. – GianMaria Romanato Nov 18 '11 at 14:57
  • Did yuo made any recent commit since you cloned that repo (and before doing those log commands)? – VonC Nov 18 '11 at 15:34
  • No, no changes. The flow is the following: 1. clone a remote bare repo 2. execute command above in the cloned repo 3. telnet to remote server 4. execute command above in the remote repo No commmits in between – GianMaria Romanato Nov 18 '11 at 15:38
  • Instead of using `--branches`, did you try the same command with the branch name directly? (a bit like suggested in http://stackoverflow.com/questions/5316802/does-git-log-branches-work) – VonC Nov 18 '11 at 15:54
  • Excellent. I have added an answer for more visibility on that command. – VonC Nov 22 '11 at 15:34

1 Answers1

10

Following the suggestion of "Does git log --branches work?", I have suggested in the comments:

git log --since=2011-10-01 mybranch

I.e:

  • using the name of the branch directly
  • not using the --branches option when accessing the logs of a given branch.

The OP giamma reports it works.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250