(Day 42 of 100) GitHub
2 min readMar 8, 2019
Topics Covered: commit, deploy and update changes on GitHub
0. Links
- My deployed web app : https://dyl4810.github.io/recursiveTreeviewExample/
- Useful GitHub cheatsheet: https://gist.github.com/hofmannsven/6814451
- Commit on GitHub
- Create GitHub account
- Create new repository on the website

- To commit the app on GitHub, run below commands on the terminal at the local file location where the app lives (Note: you should have git installed on your local machine)
#Initialize git
$ git init#add all changed file paths to staged changes
$ git add .#commit all staged changes
$ git commit -m 'initial commit'#add remote repository
$ git remote add origin https://github.com/dyl4810/recursiveTreeviewExample#push local repository to remote repository on GitHub
$ git push origin master
2. Deploy create-react-app + redux on GitHub
- To deploy the app on GitHub, modify package.json file and run commands as illustrated below.

#install gh-pages package
$ npm install --save gh-pages#build ?? what does this do exactly ??
$ npm run build#deploy application
$ npm run deploy#After the deployment, a second "gh-pages" branch is created on the repository which contains the static code (code that does not interact with server-side is what I understood)
3. Update changes on GitHub
- Update is very similar to commit. See below
#Initialize git
$ git init#add all changed file paths to staged changes
$ git add .#commit all staged changes
$ git commit -m 'what ever your comment goes here'#push local repository to remote repository on GitHub
$ git push origin master
4. Change repository
- To change repository, you need to first remove already assigned repository from your app, then reassign to the new repository. See below.
#Check assigned repository
$ git remote -v
origin https://github.com/dyl4810/recursiveTreeviewExample (fetch)
origin https://github.com/dyl4810/recursiveTreeviewExample (push)#Remove Remote
$ git remote rm origin
$ git remote -v#Add new repository
$ git remote add origin https://github.com/dyl4810/dynamicDataTable
5. Ignore some files and folders
#you can achieve this by setting up .gitingore on the root path of
#your project and write files you wish to ignore.#Helpful tip: gitignore.io gives default list of things you should
#ignore in any framework.