Skip to main content

Fix a warning when running git checkout inside gm

ID
946e802
date
2025-06-11 10:31:16+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
973aa57
message
Fix a warning when running `git checkout` inside `gm`
changed files
1 file, 7 additions, 1 deletion

Changed files

git/gm (1708) → git/gm (1897)

diff --git a/git/gm b/git/gm
index 7d68181..6a4cc0f 100755
--- a/git/gm
+++ b/git/gm
@@ -12,10 +12,16 @@ ROOT="$(git rev-parse --show-toplevel)"
 #     Already on 'main'
 #     Your branch is up to date with 'origin/main'.
 #
+# The `--quiet` flag is to avoid a warning like:
+#
+#     Your branch is behind 'origin/main' by 6 commits, and can be 
+#    fast-forwarded.
+#
+# because I know I'm about to do that.
 if [[ $(gcb) != $(_get_primary_branch) ]]
 then
   print_info "-> git checkout $(_get_primary_branch) (was on $(gcb))"
-  git checkout "$(_get_primary_branch)"
+  git checkout "$(_get_primary_branch)" --quiet
   echo ""
 fi