Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Introduction to git - for SLC-JS-Learners 2015-08 meetup

Intro to git

  1. create/log-into your http://github.com account

  2. create/log-into your http://c9.io account, using your github account credentials

  3. from your C9 dashboard, create a new workspace, name it "intro-to-git", leave all other options at default values, then "Create workspace"

  4. in github, create a "New repository" that is also named "intro-to-git"

  5. walk through the new github project page, plus these additional commands:

```

echo "# intro-to-git" >> README.md // click gear/settings for file tree; show hidden files ```

```
git init 
// explore .git
// open config
git status
git add readme.md
```  
```
git add README.md
git status
git log
```  
```
git commit -m "first commit"
git status
git log
```
```
git remote add origin https://github.com/SLC-JS-Learners/intro-to-git.git // USE YOUR REPO'S URL
// open config & review "[remote "origin"]" section; http://www.gitguys.com/topics/the-configuration-file-remote-section/
// close config file & re-hide hidden files
```  
```
git push -u origin master
// review "[branch "master"]" section in config; http://stackoverflow.com/a/5561327/4285306
// refresh github repo
```  
  1. git branch -a

  2. git checkout -b awesome-new-feature // checkout; -b; branch-name

  3. git branch -a // terminal info

  4. git status

  5. c9 open README.md

  6. edit your README.md file ; http://www.patorjk.com/software/taag/#p=display&f=Big&t=SLC-JS-Learners; ensure there is a tab, or three spaces, in front of each line ;-)

  7. cmd-s

  8. git commit

  9. git status

  10. git add README.md

  11. git status

  12. git commit

  13. update message & description

  14. ctrl-o; enter; ctrl-x

  15. git log

  16. q

  17. refresh github

  18. git push origin master // refresh github; check branches

  19. git push

  20. git push --set-upstream origin awesome-new-feature

  21. review README.md

  22. git checkout master

  23. review README.md

  24. git branch -a

  25. git status

  26. git diff awesome-new-feature

  27. git diff master awesome-new-feature README.md

  28. git merge awesome-new-feature

  29. git status

  30. git push

  31. refresh github; review branches

  32. git branch -a

  33. git branch -d awesome-new-feature

  34. git push // refresh github; check branches

  35. git push origin --delete awesome-new-feature // refresh github; check branches

  36. git checkout -b even-more-awesome-new-feature

  37. edit and save your README.md

  38. git add README.md

  39. git commit -m "even-more-awesome-new-feature README.md updated"

  40. git push

  41. git push --set-upstream origin even-more-awesome-new-feature

  42. refresh and review in github

  43. edit and save your README.md one more time

  44. git add README.md

  45. git commit -m "even-more-awesome-new-feature README.md updated yet again" // xkcd's Git Commit

  46. git push

  47. git log

  48. q

  49. git checkout master

  50. git merge even-more-awesome-new-feature

  51. git push origin --delete even-more-awesome-new-feature // remote & remote ref deletions

  52. refresh github & review branches

  53. git branch -d even-more-awesome-new-feature // local deletion

  54. git branch -a

C9 Related Shortcuts (mac)

Alternatives to GitHub

Additional Git Resources

Tutorials, Walkthroughs, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.