MBaas
MBaas

Reputation: 7530

git -log -1 --format=%ci shows nothing (w/o --format does) - what's the problem?

I'm in the root-folder of a repo and can do git log -1 and it shows the most recent commit-message with author and date. git status confirms that the repo is up to date with the remote origin/master and that the working tree is clean.

However, git log -1 --format=%ci shows nothing. (%ci = "committer date, ISO 8601-like format) The same with other formats, like %aN, %cn or %as.

What's the problem?

P.S: I'm running this on W10 inside TakeCommand with git version 2.26.2.windows.1

Upvotes: 0

Views: 725

Answers (1)

knittl
knittl

Reputation: 265605

% is used by Windows to access variable's values, e.g. %USER%. Because the variable %ci does not exist, it will be replaced with an empty string and your format becomes --format=''.

Double the percent sign to get a literal percent:

git log -1 --format=%%ci

Upvotes: 2

Related Questions