Never push "HEAD"; don't touch current branch
This commit is contained in:
parent
b911a03848
commit
655f5c2fb4
1 changed files with 3 additions and 2 deletions
|
@ -81,6 +81,7 @@ for branchspec in "${branches[@]}"; do
|
||||||
set $branchspec
|
set $branchspec
|
||||||
leader_sha="$1"
|
leader_sha="$1"
|
||||||
branch="$2"
|
branch="$2"
|
||||||
|
if [ "$branch" = HEAD ]; then continue; fi
|
||||||
|
|
||||||
for remote in "${followers[@]}"; do
|
for remote in "${followers[@]}"; do
|
||||||
echo
|
echo
|
||||||
|
@ -90,7 +91,7 @@ for branchspec in "${branches[@]}"; do
|
||||||
|
|
||||||
if ! ref_exists "$follower_ref"; then
|
if ! ref_exists "$follower_ref"; then
|
||||||
echo "Branch doesn't yet exist at remote, creating"
|
echo "Branch doesn't yet exist at remote, creating"
|
||||||
git reset --hard "$leader_sha" --
|
git checkout "$leader_sha" --
|
||||||
git push "$remote" "+HEAD:$branch" || { error "$remote $branch: failed to push"; continue; }
|
git push "$remote" "+HEAD:$branch" || { error "$remote $branch: failed to push"; continue; }
|
||||||
|
|
||||||
elif is_ref_at_sha "$follower_ref" "$leader_sha"; then
|
elif is_ref_at_sha "$follower_ref" "$leader_sha"; then
|
||||||
|
@ -98,7 +99,7 @@ for branchspec in "${branches[@]}"; do
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Branch exists at remote, updating"
|
echo "Branch exists at remote, updating"
|
||||||
git reset --hard "$follower_ref" --
|
git checkout "$follower_ref" --
|
||||||
git merge --ff-only "$leader_sha" || { error "$remote $branch: FF not possible"; continue; }
|
git merge --ff-only "$leader_sha" || { error "$remote $branch: FF not possible"; continue; }
|
||||||
git push "$remote" "+HEAD:$branch" || { error "$remote $branch: failed to push"; continue; }
|
git push "$remote" "+HEAD:$branch" || { error "$remote $branch: failed to push"; continue; }
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue