{
  "$type": "site.standard.document",
  "path": "/wip-git-commit-shortcut/",
  "publishedAt": "2024-10-07T02:33:00.000Z",
  "site": "at://did:plc:bryys25pc2fnagnyxqgsglhd/site.standard.publication/3mn26bjkkmh23",
  "tags": [
    "git",
    "Scripts"
  ],
  "textContent": "I was wrong; I thought I figured out the Git script I used the most everyday. Turns out, it is this:\n\nw\n\nIt has a variation:\n\nw 'Some commit message'\n\nRunning w alone uses WIP as the default commit message.\n\nI wrote it as a fish shell function, but it should be easy to convert to a shell script:\n\n#w and ww are the same. Except the latter has a '-n' option\nfunction w\n    #set --local staged (gs | cut -c1 | ag -v \"\\?\" | string collect | string trim)\n    set --local staged (git status -s | grep \"^[MADRCU]\" | string collect | string trim)\n    if test -n \"$staged\"\n        #echo \"something staged\"\n    else\n        #echo \"nothing staged\"\n        git add .\n    end\n\n    if not string length -q -- \"$argv\"\n        gc -m 'WIP' \n    else\n        gc -m \"$argv\"\n    end\nend",
  "title": "WIP Git Commit Shortcut"
}