user1519240
user1519240

Reputation: 2354

How to set branch format in gitconfig (not an alias)

I have this alias git config --global alias.recent 'branch --sort=-committerdate --format="%(committerdate:relative)%09%(refname:short)"', it works fine: git recent

but I want to make this default behaviour when doing git branch using a gitconfig file. I can't get the format piece working:

[branch]
  # this works
  sort = -committerdate
  
  # doesn't work:
  format = \"%(committerdate:relative)%09%(refname:short)\"
  # neither:
  format = "%(committerdate:relative)%09%(refname:short)"

[alias]
  # this is what git config command above adds:
  recent = branch --sort=-committerdate --format=\"%(committerdate:relative)%09%(refname:short)\"

When I do git branch just the sorting works. How can I get the format working as well?

Upvotes: 0

Views: 115

Answers (1)

phd
phd

Reputation: 94407

Not every command line option has its config counterpart. git branch has a lot of options but git config branch. has only few.

Upvotes: 2

Related Questions