From c190b10e31badf4e8a1a3454f906ea5184a7a823 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Wed, 11 Jan 2023 16:38:14 +0530 Subject: [PATCH] fish: functions/gm: Automatically detect master or main and merge git merge master/main is a frequent enough operation. Automatically detect whether the primary branch is master or main and merge. --- fish/.config/fish/functions/gm.fish | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fish/.config/fish/functions/gm.fish b/fish/.config/fish/functions/gm.fish index 644c6e4..3a6915d 100644 --- a/fish/.config/fish/functions/gm.fish +++ b/fish/.config/fish/functions/gm.fish @@ -1,3 +1,8 @@ function gm - git merge $argv + if count $argv >/dev/null + git merge $argv + else + set -l remote (git symbolic-ref refs/remotes/origin/HEAD | awk -F'/' '{print $4}') + git merge origin/$remote + end end