From 7ca50698f12b80065063b094f75238d35e98999f Mon Sep 17 00:00:00 2001 From: Meas Date: Fri, 29 Sep 2023 13:46:25 +0200 Subject: [PATCH] Fix local default branch logic for "git sync" Fixed wrong local default branch. The default branch of a Git installation can be different than the default branch of the "origin" repository. E.g. repo: "master", local git: "main" --- docs/contributors/development-workflow.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/contributors/development-workflow.md b/docs/contributors/development-workflow.md index 527ddf0..622a08f 100644 --- a/docs/contributors/development-workflow.md +++ b/docs/contributors/development-workflow.md @@ -62,8 +62,9 @@ get_local_active_branch() { git branch --show } +# Sourced from: https://stackoverflow.com/a/44750379 get_local_default_branch() { - git config --get init.defaultBranch + git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@' } # Sourced from: https://stackoverflow.com/a/61357104/1277156