2

I'm trying to find out exactly when some part of a site went live by looking at the git logs.

My setup is like this:
- I have a local git repo where I'm doing development and testing and committing changes
- I push changes to a repo on my server
- when I am happy with the changes I pull them into a second repo on the same server which makes the changes live.

So I make changes, git commit, git push. Then ssh into the web server and git pull to deploy.

Using git log I can see when I made which commits but I can't work out how to tell when I did the git pull. Is this possible?

schmicko
  • 53
  • 5
  • AFAIK, git doesn't offer any functionality like that. But you can make it out using an alias and embedding some shell script to run date command and do the pull and save it in a log file. But it won't be visible when you invoke git log. – positron May 21 '12 at 07:50
  • I'm with @positron on this. But I think a way to go would be to use [`git notes`](http://schacon.github.com/git/git-notes.html) to annotate certain (pulled) commits. – kostix May 21 '12 at 10:15
  • By the way, what sense is to know when exactly the pull happened? The state of the local repository depends solely on *what* was pulled not *when* it happened. Of course, "when" implies "what" to certain degree, logically, but I have no idea why you would need to know those "whens". Could you elaborate on this? – kostix May 21 '12 at 10:17
  • It's a legal thing. I need to know as close as possible, when a certain piece of content went live. As I used a _git pull_ to deploy, I was hoping git might be able to tell me. – schmicko May 22 '12 at 00:28
  • You could automate the process with a post-merge hook in the live repo that logs all pulls to a separate file: http://schacon.github.com/git/githooks.html – ellotheth May 22 '12 at 14:29

1 Answers1

1

Pulls should show up in the reflog, I think: git reflog --format=fuller

ellotheth
  • 3,803
  • 1
  • 15
  • 28
  • 1
    Thank you. That little piece of info helped a lot. `git reflog` however still gives me the author and commit datetime not the pull datetime. But this info is available in the actual logs themselves as MikeSep [points out here](http://stackoverflow.com/a/2255538/1407208) – schmicko May 22 '12 at 01:40