One of the popular options to deploy something nowadays is git-based deployment (Github pages is a good example). Here’s a recipe to push some content to the remote branch ignoring whatever this branch already has:
echo `date` > 1.txt
git add .
git commit -m "autocommit"
git push -u https://github.com/loki2302/git-force-push-experiment.git \
rm -rf ./deploy
In this snippet:
- The directory
- Within that directory, a current time is echoed to
- Then, a brand new git repository is created, the entire folder contents are added and committed to the local
- After it comes a trick: we take the local
masterand push it to the remove
See the demo repository here.