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:1
2
3
4
5
6
7
8
9
10
11mkdir deploy
cd deploy
echo `date` > 1.txt
git init
git add .
git commit -m "autocommit"
git push -u https://github.com/loki2302/git-force-push-experiment.git \
  master:deployed --force
cd ..
rm -rf ./deploy
echo DONE
In this snippet:
- The directory 
deployis created. - Within that directory, a current time is echoed to 
1.txt. - Then, a brand new git repository is created, the entire folder contents are added and committed to the local 
master. - After it comes a trick: we take the local 
masterand push it to the removedeployedbranch. 
See the demo repository here.