Hacker News new | ask | show | jobs
by cliff_badger 1875 days ago
Usage:

  git branches
Code for your ~/.gitconfig

  branches = branch -a --sort=-committerdate --format='\
  %(HEAD) \
  %(if)%(HEAD)%(then)\ 
  %(color:"#329664")%(objectname:short)%(color:reset) \
  %(color:"#222222")[%(committerdate:short)]%(color:reset) \
  %(color:green)%(refname:short)%(color:reset) \
  %(else)\
  %(if)%(upstream)%(then)\
  %(color:"#999999")%(objectname:short)%(color:reset) \
  %(color:"#222222")[%(committerdate:short)]%(color:reset) \
  %(refname:short) \
  %(color:"#ffc662")%(upstream:track)%(color:reset) \
  %(else)\
  %(color:"#963232")%(objectname:short)%(color:reset) \
  %(color:"#222222")[%(committerdate:short)]%(color:reset) \
  %(color:red)%(refname:lstrip=1)%(color:reset)\
  %(color:"#ffc662")%(upstream:track)%(color:reset) \
  %(end)\
  %(end)\
  '
Meaning

  HASH Commit_date Branch_Name

  A white branch_name means it is local.
  Red means it is remote.
  Yellow branch_name is the current branch.
  It will also tell you if your checked out branch is ahead or behind the remote branch.
1 comments

This broke my Alacritty build:

  $ cargo build --release
  error: failed to get `bitflags` as a dependency of package `alacritty v0.9.0-dev (/home/myuser/sources/alacritty/alacritty)`
  
  Caused by:
    failed to initialize index git repository
  
  Caused by:
    failed to parse config file: invalid configuration key (in /home/myuser/.config/git/config:57); class=Config (7)