Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
shellcheck cleanups
Signed-off-by: Joe Block <jpb@unixorn.net>
  • Loading branch information
unixorn committed Apr 23, 2022
commit 6c298bf032b6704da7ab9afd3a54cb1096328458
1 change: 1 addition & 0 deletions bin/git-amend-all
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set -e
# User is not in git repository
if ! git branch > /dev/null 2>&1
then
# shellcheck disable=SC2086
echo "E: '$(basename ${PWD})' - Not a Git repository."
exit 1
fi
Expand Down
6 changes: 4 additions & 2 deletions bin/git-checkout-branches
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -e
# User is not in git repository
if ! git branch > /dev/null 2>&1
then
# shellcheck disable=SC2086
echo "E: '$(basename ${PWD})' - Not a Git repository."
exit 1
fi
Expand All @@ -24,19 +25,20 @@ _CURRENT_BRANCH="$(git branch | awk '/^\* / { print $2 }')"
# Checkout all remote branches
for _REMOTE_BRANCH in $(git branch -r | awk '{ print $1 }')
do
# shellcheck disable=SC2086
_BRANCH_NAME="$(echo ${_REMOTE_BRANCH} | cut -d/ -f 2-)"

if [ "${_BRANCH_NAME}" != "HEAD" ]
then
if ! git branch | grep -q "${_BRANCH_NAME}$"
then
git checkout -b ${_BRANCH_NAME} ${_REMOTE_BRANCH}
git checkout -b "${_BRANCH_NAME}" "${_REMOTE_BRANCH}"
fi
fi
done

# Switch back to current branch
if [ "$(git branch | awk '/^\* / { print $2 }')" != "${_CURRENT_BRANCH}" ]
then
git checkout ${_CURRENT_BRANCH}
git checkout "${_CURRENT_BRANCH}"
fi
4 changes: 2 additions & 2 deletions bin/git-merged-branches
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

for branch in $(git branch -r --merged | grep -v HEAD)
do
echo -e $(git show --format="%ci %cr %an" $branch | head -n 1) \\t$branch
done | sort -r
echo -e "$(git show --format="%ci %cr %an" $branch | head -n 1)" \\t$branch
done | sort -r