From 3d7177e84c680f01c5435b0b4d08e52306a2aceb Mon Sep 17 00:00:00 2001 From: Ivan Malopinsky Date: Tue, 27 Oct 2020 19:22:46 -0400 Subject: [PATCH 1/2] if only main branch exists, use that as root --- git-fresh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/git-fresh b/git-fresh index 5124467..08c1db7 100755 --- a/git-fresh +++ b/git-fresh @@ -159,7 +159,14 @@ fi ERR="could not get top-level-directory" TOP_LEVEL_DIRECTORY=$(git rev-parse --show-toplevel) REMOTE=${1:-origin} -ROOT=${2:-master} + +ROOT_GUESS=master + +if [[ -n $(git show-ref refs/heads/main) && -z $(git show-ref refs/heads/master) ]]; then + ROOT_GUESS=main +fi + +ROOT=${2:-$ROOT_GUESS} # Recover the root HEAD if it is missing or corrupt (e.g. master head reads "master") recover_root () { From b2fd2705581ce32dc398bfa81b97635961625cbd Mon Sep 17 00:00:00 2001 From: Ivan Malopinsky Date: Tue, 27 Oct 2020 19:23:55 -0400 Subject: [PATCH 2/2] 1.13.0 --- LICENSE | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 9608676..38fa0a8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2019 Ivan Malopinsky +Copyright (c) 2017-2020 Ivan Malopinsky Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 959c77b..70c5dfc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "git-fresh", - "version": "1.12.1", + "version": "1.13.0", "description": "Utility to keep Git repositories fresh", "global": true, "repo": "imsky/git-fresh",