Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation instruction deleted all my work #48

Open
ivanvanderbyl opened this issue Mar 21, 2016 · 13 comments
Open

Installation instruction deleted all my work #48

ivanvanderbyl opened this issue Mar 21, 2016 · 13 comments

Comments

@ivanvanderbyl
Copy link

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.

@knownasilya
Copy link
Contributor

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.

@ivanvanderbyl
Copy link
Author

Unfortunately it wiped my whole directly, including the .git directory, and everything in ../*

@ivanvanderbyl
Copy link
Author

I'm thinking the grep -vE ... doesn't work as expected for some reason.

@knownasilya
Copy link
Contributor

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.

@knownasilya
Copy link
Contributor

If you figure it out, please submit a PR for other zsh users.

@ivanvanderbyl
Copy link
Author

Well I'd like to be able to verify it, but because it deleted the .git directory there is no way to know.

@knownasilya
Copy link
Contributor

😢

@knownasilya
Copy link
Contributor

I hope you committed your changes first..

@ivanvanderbyl
Copy link
Author

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?

@ivanvanderbyl
Copy link
Author

So it looks like I have ls aliased to ls -laGF for simplicity. I'd recommend exec'ing this with a bash -c

@ivanvanderbyl
Copy link
Author

$ 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.

@knownasilya
Copy link
Contributor

Just that portion, or the whole command?

@ivanvanderbyl
Copy link
Author

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants