Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bessarabov/f0e2edaa2820915eb99082e70d6fd292 to your computer and use it in GitHub Desktop.
Save bessarabov/f0e2edaa2820915eb99082e70d6fd292 to your computer and use it in GitHub Desktop.
## Creating a sample git repo with one commit (I'm in timezone +0300 Europe/Moscow)
bessarabov@air:~$ mkdir sample
bessarabov@air:~$ cd sample/
bessarabov@air:~/sample$ git init .
Initialized empty Git repository in /Users/bessarabov/sample/.git/
bessarabov@air:~/sample$ touch a
bessarabov@air:~/sample$ git add a
bessarabov@air:~/sample$ git commit -m 'Initial commit'
[master (root-commit) 2afbb55] Initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a
bessarabov@air:~/sample$ date
Mon Jul 15 21:28:38 MSK 2019
bessarabov@air:~/sample$
## Check that --date=iso & --date=iso-local return the same time (because I'm in the same timezone that the commit author)
bessarabov@air:~/sample$ git log --date=iso
commit 2afbb5572c1b75015505016898304ccc8f4ceb5c (HEAD -> master)
Author: Ivan Bessarabov <ivan@bessarabov.ru>
Date: 2019-07-15 21:28:34 +0300
Initial commit
bessarabov@air:~/sample$ git log --date=iso-local
commit 2afbb5572c1b75015505016898304ccc8f4ceb5c (HEAD -> master)
Author: Ivan Bessarabov <ivan@bessarabov.ru>
Date: 2019-07-15 21:28:34 +0300
Initial commit
## I'm changing my timezone to UTC and see that --date=iso & --date=iso-local return different times (and --date=iso shows the time that was on the wallclock of the author)
bessarabov@air:~/sample$ TZ=UTC git log --date=iso
commit 2afbb5572c1b75015505016898304ccc8f4ceb5c (HEAD -> master)
Author: Ivan Bessarabov <ivan@bessarabov.ru>
Date: 2019-07-15 21:28:34 +0300
Initial commit
bessarabov@air:~/sample$ TZ=UTC git log --date=iso-local
commit 2afbb5572c1b75015505016898304ccc8f4ceb5c (HEAD -> master)
Author: Ivan Bessarabov <ivan@bessarabov.ru>
Date: 2019-07-15 18:28:34 +0000
Initial commit
## The same as the previous one, but using different timezone (--date=iso shows the time that was on the wallclock of the commit author)
bessarabov@air:~/sample$ TZ='America/New_York' git log --date=iso
commit 2afbb5572c1b75015505016898304ccc8f4ceb5c (HEAD -> master)
Author: Ivan Bessarabov <ivan@bessarabov.ru>
Date: 2019-07-15 21:28:34 +0300
Initial commit
bessarabov@air:~/sample$ TZ='America/New_York' git log --date=iso-local
commit 2afbb5572c1b75015505016898304ccc8f4ceb5c (HEAD -> master)
Author: Ivan Bessarabov <ivan@bessarabov.ru>
Date: 2019-07-15 14:28:34 -0400
Initial commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment