Skip to main content

add two of my git shortcuts

ID
9eef7e3
date
2022-12-16 23:03:06+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
045f4ea
message
add two of my git shortcuts
changed files
2 files, 19 additions

Changed files

gcb (0) → gcb (167)

diff --git a/gcb b/gcb
new file mode 100755
index 0000000..65451e4
--- /dev/null
+++ b/gcb
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+# Get the name of the current branch
+# http://stackoverflow.com/a/12142066/1558022
+
+set -o errexit
+set -o nounset
+
+git rev-parse --abbrev-ref HEAD

gp (0) → gp (299)

diff --git a/gp b/gp
new file mode 100755
index 0000000..d8f3ffa
--- /dev/null
+++ b/gp
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+# Pull any changes from the remote Git server.
+#
+# This includes removing any branches which have been deleted on the remote,
+# e.g. when a GitHub pull request is merged.
+
+set -o errexit
+set -o nounset
+
+git pull origin $(git rev-parse --abbrev-ref HEAD)
+git fetch origin --prune