Super bash by @Rongzhou
Appearance
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== Git and related == | == Git and related == | ||
Remote: | |||
<syntaxhighlight lang="bash" copy> | |||
git remote -v | |||
git remote -h # for more options | |||
</syntaxhighlight> | |||
=== Github CLI (<code>gh</code>) === | === Github CLI (<code>gh</code>) === | ||
Set remote: | |||
<syntaxhighlight lang="bash" copy> | <syntaxhighlight lang="bash" copy> | ||
gh repo set-default {target} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Merge pr and delete local git worktree + remote branches | |||
<blockquote> | <blockquote> | ||
First set `$pr` to the PR number. | First set `$pr` to the PR number. | ||
</blockquote> | </blockquote> | ||
<syntaxhighlight lang="bash" copy> | |||
b=$(gh pr view $pr --json headRefName -q .headRefName); w=$(git worktree list --porcelain | awk -v r="refs/heads/$b" '/^worktree /{p=substr($0,10)} /^branch / && $2==r {print p}'); [ -n "$w" ] && git worktree remove "$w"; gh pr merge $pr --merge --delete-branch | |||
</syntaxhighlight> | |||
== File ops == | |||
Enumerate non <code>.gitignore</code>d files: | |||
<syntaxhighlight lang="bash" copy> | |||
git ls-files -z '*.md' | xargs -0 | |||
</syntaxhighlight> | |||
Latest revision as of 09:28, 15 October 2026
Git and related
Remote:
git remote -v
git remote -h # for more options
Github CLI (gh)
Set remote:
gh repo set-default {target}
Merge pr and delete local git worktree + remote branches
First set `$pr` to the PR number.
b=$(gh pr view $pr --json headRefName -q .headRefName); w=$(git worktree list --porcelain | awk -v r="refs/heads/$b" '/^worktree /{p=substr($0,10)} /^branch / && $2==r {print p}'); [ -n "$w" ] && git worktree remove "$w"; gh pr merge $pr --merge --delete-branch
File ops
Enumerate non .gitignored files:
git ls-files -z '*.md' | xargs -0