Skip to content

Instantly share code, notes, and snippets.

@LSTANCZYK
Forked from troter/force-one-head
Last active August 29, 2015 14:15
Show Gist options
  • Save LSTANCZYK/e236f095b4cb1d6a6173 to your computer and use it in GitHub Desktop.
Save LSTANCZYK/e236f095b4cb1d6a6173 to your computer and use it in GitHub Desktop.
#!/bin/bash
# force-one-head
# add the following to <repository>/.hg/hgrc :
# [hooks]
# pretxnchangegroup.forceonehead = /path/to/force-one-head
if [ $(hg heads --template "{branch}\n"|sort|uniq|wc -l) != $(hg heads --template "{branch}\n"|sort|wc -l) ]; then
echo "There are multiple heads."
echo "Please 'hg pull' and get your repository up to date first."
echo "Also, don't 'hg push --force' because that won't work either."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment