git --git-dir=.git log --pretty='%ct %h' -1
git --git-dir=.git log --pretty='%h' -1

More info about the formatting options: http://git-scm.com/docs/pretty-formats

@param {string} format
@param {object} options
@param {function} callback
965267
function git(format, options, callback) {
    var joined = path.join(options.repo, '.git');

    if (!fs.existsSync(joined)) {
        callback(new Error('No .git folder detected in the directory \'' + options.repo + '\''), null);
        return;
    }

    var stdout = '';
    var stderr = '';
    var child = spawn(options.git, ['--git-dir=' + joined, 'log', '--pretty=' + format, '-1'], {cwd: process.cwd()});

    child.stdout.setEncoding('utf8');
    child.stdout.on('data', function (data) {
        stdout += data;
    });

    child.stderr.setEncoding('utf8');
    child.stderr.on('data', function (data) {
        stderr += data;
    });

    child.on('close', function() {
        if (stderr.length > 0) {
            callback(new Error('An error occurred: \'' + stderr + '\''), null);
        } else {
            var normalized = stdout.replace(/(?:\r\n|\r|\n)/g, '');
            callback(null, normalized);
        }
    });
}
944270
function toaMorgan (format, options) {
  format = format || 'combined'
  options = options || {}

  // output on request instead of response
  const immediate = !!options.immediate
  // check if log entry should be skipped
  const skip = typeof options.skip === 'function' ? options.skip : null
  // format function
  const formatLine = compile(formats[format] || format)
  // stream
  const stream = options.stream || process.stdout

  return function logger (done) {
    this._startTime = Date.now()
    this._endTime = 0

    if (immediate) logRequest.call(this)
    else this.on('end', handle).on('close', handle)

    done()
  }

  function handle () {
    this.removeListener('end', handle).removeListener('close', handle)
    this._endTime = Date.now()
    logRequest.call(this)
  }

  function logRequest () {
    if (skip && skip.call(this)) return
    let line = formatLine.call(this)
    if (line != null) stream.write(line + '\n')
  }
}
489154
function selectFormat(format) {
  let method = "toTable";
  let extension = `.${format}`;

  switch (format) {
    case "json":
      method = "toJSON";
      break;
    case "csv":
      method = "toCSV";
      break;
    case "html":
      method = "toHTML";
      break;
    case "md":
      method = "toMarkdown";
      break;
    default:
      break;
  }

  return {
    extension: extension,
    method: method
  }
}
453902
def git_pretty():
    """"""
    if git_repo() is None:
        return "unknown"
    pretty = subprocess.check_output(
        ["git", "log", "--pretty=format:%h %s", "-n", "1"])
    pretty = pretty.decode("utf-8")
    pretty = pretty.strip()
    return pretty
480761
function formatError(error) {
        function localize(key) {
            if (Strings[key]) {
                return Strings[key];
            }
            console.log("Unknown installation error", key);
            return Strings.UNKNOWN_ERROR;
        }

        if (Array.isArray(error)) {
            error[0] = localize(error[0]);
            return StringUtils.format.apply(window, error);
        } else {
            return localize(error);
        }
    }
1207173
function exec_console(func, log, format) {
                if (format === 'json') {
                    func(JSON.stringify(log));
                } else {
                    func(
                        ' ' + log.type + '\n',
                        'CREATED: ' + log.created + '\t ' + '\n',
                        'MESSAGE: ' + log.message + '\t ' + log.trace + '\n',
                        !!log.data ? 'DATA:' + log.data + '\n' : '',
                        '\n'
                    );
                }
            }
574848
function format(fmt) {
  var args = [].slice.call(arguments, 0);
  var tty = true;
  var test = (typeof fmt === 'function') ? fmt : null;
  if(test) {
    tty = test();
    args.shift();
  }
  args.unshift({scope: util, method: util.format, tty: tty});
  //console.dir(args);
  return proxy.apply(null, args);
}
343605
function setFormat(format) {
            if (format === null || format === undefined) {
                throw new Error("Format is not defined " + this.clazz.$name);
            }

            if (this.format !== format) {
                this.format = format;
                this.$getSuper("setValue").call(this, this.$format(this.date));
            }

            return this;
        }
1352833
def dev_format(errors = @output[:raw_data])
        return if errors.blank?

        pretty_output = ''
        errors.each do |filename, error_list|
          filename = strip_working_dir(filename)
          pretty_output << "\n#{filename.color(:cyan).underline} \n"
          error_list.each do |message|
            pretty_output << severity_color(message['severity'])
            pretty_output << " #{message['line'].to_s.color(:blue)} #{message['linter'].color(:green)}: #{message['reason']} \n"
          end
        end
        pretty_output << "-----\n\n"
        pretty_output
      end
294663
function format(f) {
  var i = 1;
  var args = arguments;
  var len = args.length;
  var str = String(f).replace(formatRegExp, function(x) {
    if (x === '%%') { return '%'; }
    if (i >= len) { return x; }
    switch (x) {
      case '%s':
        return String(args[i++]);
      case '%d':
        return Number(args[i++]);
      case '%j':
        return JSON.stringify(args[i++]);
      default:
        return x;
    }
  });
  return str;
}
131714
function (cb) {
    exec('git log -n1 --format=format:\'%h\'', function (err, stdout) {
      if (err) {
        cb(err);
      }
      else {
        var commitId = stdout.replace(/'/g, '');
        cb(null, commitId);
      }
    });
  }
96545
function _Markdown_formatOptions(options) {
    function toHighlight(code, lang) {
      if (!lang && elm$core$Maybe$isJust(options.defaultHighlighting)) {
        lang = options.defaultHighlighting.a;
      }

      if (
        typeof hljs !== "undefined" &&
        lang &&
        hljs.listLanguages().indexOf(lang) >= 0
      ) {
        return hljs.highlight(lang, code, true).value;
      }

      return code;
    }

    var gfm = options.githubFlavored.a;

    return {
      highlight: toHighlight,
      gfm: gfm,
      tables: gfm && gfm.tables,
      breaks: gfm && gfm.breaks,
      sanitize: options.sanitize,
      smartypants: options.smartypants
    };
  }
837220
function winstonFormatter (options) {
    // get callsite to for filename:linenumber where logger was called
    var callsite = callsites()[10]
    // string to log
    return options.level + ': '
        + (typeof options.message === 'string' ? options.message : '' )
        + ' (' + callsite.getFileName() + ':'
        + callsite.getLineNumber() + ':'
        + callsite.getColumnNumber() + ')'
        + (typeof options.meta === 'object' && Object.keys(options.meta).length ? '\n\t'+ JSON.stringify(options.meta) : '' )
}
464700
function gitStatus(file, callback) {
        exec('git status --porcelain ' + file, {}, function (error, stdout, stderr) {
            if (error || stderr) {
                grunt.fatal("Error with git status: " + stderr);
            }
            callback(stdout ? false : true);
        });
    }
194681
public void debugv(String format, Object... params) {
        doLog(Level.DEBUG, FQCN, format, params, null);
    }
1234859
function formatOutput (results) {
  var date = new Date()
  var commit

  try {
    commit = execSync('git rev-parse HEAD').toString().replace('\n', '')
  } catch (e) {
    commit = 'commit hash not found'
  }

  return {
    meta: {
      title: 'example benchmark',
      version: pkg.version,
      commit: commit,
      date: [
        date.toLocaleDateString(),
        date.toLocaleTimeString(),
        date.toString().match(/\(([A-Za-z\s].*)\)/)[1]
      ].join(' ')
    },
    results: results
  }
}
1004518
function format(str, formats) {
	let cachedFormats = formats;

	if (!Ember.isArray(cachedFormats) || arguments.length > 2) {
		cachedFormats = new Array(arguments.length - 1);

		for (let i = 1, l = arguments.length; i < l; i++) {
			cachedFormats[i - 1] = arguments[i];
		}
	}

	let idx = 0;
	return str.replace(/%@([0-9]+)?/g, function(s, argIndex) {
		argIndex = (argIndex) ? parseInt(argIndex, 10) - 1 : idx++;
		s = cachedFormats[argIndex];
		return (s === null) ? '(null)' : (s === undefined) ? '' : Ember.inspect(s);
	});
}