Bash Script to Force an Empty Git Push
Wed, Apr 1, 2009
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.
Why not subscribe to the feed?. If you’re on a mobile device I suggest Viigo
Tags: Automation, bash, git, scripting, Scripts
Leave a Reply