Jump to content

Super bash by @Rongzhou

From Wikibase
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>
gh repo set-default {target}
</syntaxhighlight>


Merge pr and delete local git worktree + remote branches
Merge pr and delete local git worktree + remote branches

Revision as of 11:39, 9 October 2026

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

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

First set `$pr` to the PR number.