Skip to content
Go back

Forcing arbitrary content deployment to the git branch

Edit page

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:

mkdir deploy
cd deploy
echo `date` > 1.txt
git init
git add .
git commit -m "autocommit"
git push -u https://github.com/agibalov/git-force-push-experiment.git \
  master:deployed --force
cd ..
rm -rf ./deploy
echo DONE

In this snippet:

See the demo repository here.


Edit page
Share this post on:

Previous Post
Not the Worst Way
Next Post
Parameterized AngularJS directives