This is for Ruby on Rails and Mercurial users, such as myself 🙂
- cp .gitignore .hgignore
- .hgignore: prepend syntax:glob:Â sed -i ‘1i syntax: glob\n’ .hgignore
- .hgignore: sort:Â sed -i ‘1,2d’ .hgignore && LC_ALL=C sort .hgignore && sed -i ‘1i syntax: glob\n’ .hgignore
- echo “Gemfile.lock” >> .hgignore
- (echo ‘*.swp’ >> .hgignore; echo ‘.idea/’ >> .hgignore)
- find . -name ‘.git*’ -delete
- find . -type d -empty -exec touch {}/.keep \;
- hg init
- hg ci -Am ‘Generate project, setup .hgignore & remove .git*’
(Edit: Split add header and sort, otherwise it trunks the first 3 lines of .hgignore prematurely)
(Edit: Simplify the two modification 1-liners using sed)