From c1b0067a97b0f64b4b17e8be3abfba79ac9ec7d3 Mon Sep 17 00:00:00 2001 From: Ciro Nunes Date: Tue, 3 Mar 2015 09:01:19 -0300 Subject: [PATCH] fix gh-pages to stash and don't delete files Closes #137 --- bin/git-gh-pages | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/bin/git-gh-pages b/bin/git-gh-pages index b7f3a8c..f51c813 100755 --- a/bin/git-gh-pages +++ b/bin/git-gh-pages @@ -1,12 +1,21 @@ #!/usr/bin/env bash echo 'setting up gh-pages' -git symbolic-ref HEAD refs/heads/gh-pages \ - && rm .git/index \ - && git clean -fdx \ - && echo 'My Page' > index.html \ - && git add . \ - && git commit -a -m 'Initial commit' \ - && git push -u origin gh-pages \ - && git fetch origin \ - && echo 'complete' +echo '-------------------' + +echo 'Tell me your github account username: ' +read username + +echo 'Now, tell me your repository name: ' +read repository + +git stash \ +&& git checkout -b 'gh-pages' \ +&& echo 'My Page' > index.html \ +&& git add . \ +&& git commit -a -m 'Initial commit' \ +&& git remote add origin https://github.com/"$username"/"$repository".git \ +&& git push -u origin gh-pages \ +&& echo 'Complete' \ +&& echo '-------------------' \ +&& echo 'You can find your last changes in the stash!'