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
|
||||
leader_sha="$1"
|
||||
branch="$2"
|
||||
if [ "$branch" = HEAD ]; then continue; fi
|
||||
|
||||
for remote in "${followers[@]}"; do
|
||||
echo
|
||||
|
@ -90,7 +91,7 @@ for branchspec in "${branches[@]}"; do
|
|||
|
||||
if ! ref_exists "$follower_ref"; then
|
||||
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; }
|
||||
|
||||
elif is_ref_at_sha "$follower_ref" "$leader_sha"; then
|
||||
|
@ -98,7 +99,7 @@ for branchspec in "${branches[@]}"; do
|
|||
|
||||
else
|
||||
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 push "$remote" "+HEAD:$branch" || { error "$remote $branch: failed to push"; continue; }
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue