1

I'm trying to get the date-time of the last commit with whitespaces:

 git log -n 1 --pretty=format:%cd --date=format:%d %b %Y 

An exception is:

fatal: ambiguous argument '%b': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' 
1
  • Exercises: (a) How many words are there in the phrase "See spot run"? (I know this seems trivial, it's to prepare for the next two.) (b) How many words are there in format:%d %b %Y? (c) How many words does --date expect after the = sign? There are a few Git commands/options that do expect, or at least handle, more than one word, but is --date one of them? Commented Jul 28, 2017 at 4:32

2 Answers 2

1

It seems to work with double quotes (using git version 2.13.1.windows.1):

vonc@VONCAVN7 D:\git\git > git log -n 1 --pretty=format:%cd --date=format:"%d %b %Y" 15 Jun 2017 

It works in bash too:

vonc@voncavn7 MINGW64 /d/git/git (master) $ git log -n 1 --pretty=format:%cd --date=format:"%d %b %Y" 15 Jun 2017 
Sign up to request clarification or add additional context in comments.

Comments

0

The following command will be helpful:

 git log -1 --format=%cd 

Abow command will print the latest change date. The -1 shows one log entry (the most recent), for more details check this link.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.