Skip to content

Instantly share code, notes, and snippets.

@ento
Created May 15, 2025 02:22
Show Gist options
  • Save ento/83738ba362356650f424b76e39ff93b7 to your computer and use it in GitHub Desktop.
Save ento/83738ba362356650f424b76e39ff93b7 to your computer and use it in GitHub Desktop.

Revisions

  1. ento revised this gist May 15, 2025. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions .gitconfig
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    [alias]
    # Alias to get the nearest parent; adapetd from https://stackoverflow.com/a/17843908
    # Alias to get the nearest parent; adapetd from https://stackoverflow.com/a/17843908
    parent = "!git show-branch 2>/dev/null | grep '*' | grep -v \"$(git rev-parse --abbrev-ref HEAD)\" | head -n1 | sed 's/[^\\[]*\\[\\([^\\[]*\\)\\].*/\\1/' | sed 's/[\\^~].*//' #"
    # Print the number of lines changed sicne the parent branch. e.g. branch-name +10 -10
    # Print the number of lines changed sicne the parent branch. e.g. branch-name +10 -10
    size = "!echo -n \"$(git parent) \"; git diff $(git parent)...HEAD --numstat | awk '{ additions+=$1; deletions+=$2 } END { print \"\\033[32m\" \"+\" additions \"\\033[0m\" \" \" \"\\033[31m\" \"-\" deletions }' #"
  2. ento created this gist May 15, 2025.
    5 changes: 5 additions & 0 deletions .gitconfig
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    [alias]
    # Alias to get the nearest parent; adapetd from https://stackoverflow.com/a/17843908
    parent = "!git show-branch 2>/dev/null | grep '*' | grep -v \"$(git rev-parse --abbrev-ref HEAD)\" | head -n1 | sed 's/[^\\[]*\\[\\([^\\[]*\\)\\].*/\\1/' | sed 's/[\\^~].*//' #"
    # Print the number of lines changed sicne the parent branch. e.g. branch-name +10 -10
    size = "!echo -n \"$(git parent) \"; git diff $(git parent)...HEAD --numstat | awk '{ additions+=$1; deletions+=$2 } END { print \"\\033[32m\" \"+\" additions \"\\033[0m\" \" \" \"\\033[31m\" \"-\" deletions }' #"