Question

Currently the only way to view the tfs checkin id is by using the git log command. As any other git users, I have my prettified git log, so I'd like to include the tfs checkin id flag into my git logs.

It would also be a plus if there's a flag I can use for my prettified log to know if a commit is a local git commit or a tfs checkin commit.

Here's my git alias to return the last ten commits:

[alias]
ten = log --pretty=format:\"%C(yellow)%h%Creset %ad %C(green)%s %Creset[%an]\" --graph --date=short --no-merges -10

I'd like to achieve something like this:

[alias]
ten = log --pretty=format:\"%C(yellow)%h%Creset %ad %CONDITIONAL(IF %TFSCHECKINID NOT NULL){%C(red)[%TFSCHECKINID]} %C(green)%s %Creset[%an]\" --graph --date=short --no-merges -10

It should appear like this:

* xxxxxx yyyy-mm-dd [C9999] This is a TFS checkin [Anonymous]
* xxxxxx yyyy-mm-dd This is a local git commit [Anonymous]
Was it helpful?

Solution

One thing to try is adding --decorate or the %d format placeholder to include the refs that point to the commit. This doesn't mark all the commits, but it will put tfs/default on the TFS head, which should make it pretty obvious which of your recent commits aren't from TFS. You might also try %gd or %gD.

You can also turn on autotagging in your project's config, and use %d.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top