react 事始め
Githubでレポジトリを作成し、ローカルにクローン
$ git clone https://github.com/xxxxxx/react-redux-crud-app.git
yarn でcreate-react-app
をインストール
$ yarn global add create-react-app
yarn global list
でグローバルにインストールされているモジュールを確認
$ yarn global list yarn global v1.15.2 info "create-react-app@2.1.5" has binaries: - create-react-app $ which create-react-app /Users/xxxxxx/.config/yarn/global/node_modules/.bin/create-react-app
gitでブランチを作成した後、create-react-app
でアプリケーションを作成
$ cd react-redux-crud-app $ create-react-app .
git statusでファイルの変更を確認
$ git status On branch create-app Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: .gitignore modified: README.md Untracked files: (use "git add <file>..." to include in what will be committed) README.old.md package.json public/ src/ yarn.lock no changes added to commit (use "git add" and/or "git commit -a")
modifiedした.gitignore
をgit diffで変更内容を確認し、問題なければ、git add
$ git add .gitignore
もう一つのmodifiedしたREADME.md
をgit diffで変更内容を確認し、元の状態に戻す時は、git checkout
$ git checkout README.md
変更前のREADMEファイルのバックアップのREADME.old.md
は不要であるので削除し、その他はgit add
$ rm README.old.md $ git add .
yarn startでブラウザが立ち上がるか確認。
$ yarn start
立ち上がったらブラウザを停止し、git commit、git push ローカルへのpush→マスタに戻り→マスタにマージ→レポジトリへpush
$ git push -u origin HEAD $ git checkout - $ git merge --no-ff - -m "merge branch into master" $ git push origin HEAD
その他で検索でgit grepが使える
$ git grep "Learn React" src/App.js: Learn React
これでひとまずappを作る環境整備を完了!