#!/bin/bash

set -e

# Create remote1, remote2, local.
git init --bare remote1
git init --bare remote2
git init local
cd local
git remote add origin ../remote1
git remote set-url --push origin ../remote1
git remote set-url --push --add origin ../remote2

# Add commit A and push.
echo 'hello world' > test.txt
git add test.txt
git commit -m 'Commit A'
git push -u origin master

# Amend to commit B.
echo 'goodbye world' > test.txt
git add test.txt
git commit --amend --no-edit

# Force-push.
git push --force-with-lease
