Sometimes, like when you’re testing hooks or trying to create synced remote and local repos, you’ll find yourself touching empty files just to get a git push going. This script automates this task by creating a unique temporary file, committing it, pushing, and then removing the file.
#!/bin/sh TMP=tmp-`date +'%m%s'` touch $TMP git add $TMP git commit $TMP -m '(forced push)' git push git rm $TMP </pre> Usage, assuming you named it git-force and made it executable (chmod) <pre lang="bash">cd git-repo/ ./git-force
I place this in ~/bin/ which is in my $PATH. You might want to if you use this a lot.