Installation instruction deleted all my work
ivanvanderbyl opened this issue · comments
I just tried following the installation instructions, however it deleted not only my project, but everything in the parent directory.
git checkout --orphan gh-pages && rm -rf `ls -a | grep -vE '\.gitignore|\.git|node_modules|bower_components|(^[.]{1,2}/?$)'` && git add -A && git commit -m "initial gh-pages commit"
I'm shell zsh
, so maybe something in here which doesn't work as expected.
It should create a blank gh-pages branch, so it might look like it broke your current branch. Try git branch
to see which ones you have and the current one.
Unfortunately it wiped my whole directly, including the .git
directory, and everything in ../*
I'm thinking the grep -vE ...
doesn't work as expected for some reason.
Weird, did it at least create the gh-pages branch? Commands work left to right, and that's the first command before the grep
and rm
.
If you figure it out, please submit a PR for other zsh
users.
Well I'd like to be able to verify it, but because it deleted the .git
directory there is no way to know.
😢
I hope you committed your changes first..
Luckily this repo was up to date, unfortunately in the parent directory was my EmberConf talk source code, which wasn't released yet :(.
So I figured out why this happens:
ls -a | grep -vE '\.gitignore|\.git|node_modules|bower_components|(^[.]{1,2}/?$)'
total 120
drwxr-xr-x 23 ivanvanderbyl staff 782 21 Mar 13:09 ./
drwxr-xr-x 3 ivanvanderbyl staff 102 21 Mar 13:09 ../
-rw-r--r-- 1 ivanvanderbyl staff 60 21 Mar 13:09 .bowerrc
-rw-r--r-- 1 ivanvanderbyl staff 543 21 Mar 13:09 .editorconfig
-rw-r--r-- 1 ivanvanderbyl staff 280 21 Mar 13:09 .ember-cli
-rw-r--r-- 1 ivanvanderbyl staff 518 21 Mar 13:09 .jshintrc
-rw-r--r-- 1 ivanvanderbyl staff 192 21 Mar 13:09 .npmignore
-rw-r--r-- 1 ivanvanderbyl staff 625 21 Mar 13:09 .travis.yml
-rw-r--r-- 1 ivanvanderbyl staff 37 21 Mar 13:09 .watchmanconfig
-rw-r--r-- 1 ivanvanderbyl staff 1066 21 Mar 13:09 LICENSE.md
-rw-r--r-- 1 ivanvanderbyl staff 2992 21 Mar 13:18 README.md
drwxr-xr-x 5 ivanvanderbyl staff 170 21 Mar 13:09 addon/
drwxr-xr-x 4 ivanvanderbyl staff 136 21 Mar 13:09 app/
-rw-r--r-- 1 ivanvanderbyl staff 181 21 Mar 13:09 bower.json
drwxr-xr-x 4 ivanvanderbyl staff 136 21 Mar 13:09 config/
-rw-r--r-- 1 ivanvanderbyl staff 527 21 Mar 13:09 ember-cli-build.js
-rw-r--r-- 1 ivanvanderbyl staff 77 21 Mar 13:09 index.js
-rw-r--r-- 1 ivanvanderbyl staff 1399 21 Mar 13:09 package.json
-rw-r--r-- 1 ivanvanderbyl staff 237 21 Mar 13:09 testem.js
drwxr-xr-x 9 ivanvanderbyl staff 306 21 Mar 13:09 tests/
drwxr-xr-x 3 ivanvanderbyl staff 102 21 Mar 13:09 vendor/
See the problem?
So it looks like I have ls
aliased to ls -laGF
for simplicity. I'd recommend exec'ing this with a bash -c
$ bash -c "ls -a | grep -vE '\.gitignore|\.git|node_modules|bower_components|(^[.]{1,2}/?$)'"
.bowerrc
.editorconfig
.ember-cli
.jshintrc
.npmignore
.travis.yml
.watchmanconfig
LICENSE.md
README.md
addon
app
bower.json
config
ember-cli-build.js
index.js
package.json
testem.js
tests
vendor
Or even sh
to be sure.
Just that portion, or the whole command?
This seems to do the job:
git checkout --orphan gh-pages && rm -rf `bash -c "ls -a | grep -vE '\.gitignore|\.git|node_modules|bower_components|(^[.]{1,2}/?$)'"` && git add -A && git commit -m "initial gh-pages commit"