add a script for going repo -> github
- ID
ae3ab6e- date
2023-05-14 21:54:12+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
dae777f- message
add a script for going repo -> github- changed files
2 files, 21 additions
Changed files
git/README.md (2942) → git/README.md (3154)
diff --git a/git/README.md b/git/README.md
index 1fe7fe5..b7c11fa 100644
--- a/git/README.md
+++ b/git/README.md
@@ -96,6 +96,15 @@ These scripts are all shortcuts for using [Git], mostly designed to let me do my
</dd>
<dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/git/gub">
+ <code>gub</code>
+ </a>
+ </dt>
+ <dd>
+ open the current Git repo in my web browser (assuming it's a GitHub repo)
+ </dd>
+
+ <dt>
<a href="https://github.com/alexwlchan/scripts/blob/main/git/gup">
<code>gup</code>
</a>
git/gub (0) → git/gub (388)
diff --git a/git/gub b/git/gub
new file mode 100755
index 0000000..ecb816e
--- /dev/null
+++ b/git/gub
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+# Open the current Git repo in my web browser (assuming it's a GitHub repo).
+
+set -o errexit
+set -o nounset
+
+# The remote URL will be something of the form
+#
+# git@github.com:alexwlchan/photo-reviewer.git
+#
+# The tr/awk gets everything after the colon, then prepends github.com.
+open https://github.com/$(git remote get-url origin | tr ':' ' ' | awk '{print $2}')