Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git and Github

Git and Github

高見龍

May 08, 2013
Tweet

More Decks by 高見龍

Other Decks in Technology

Transcript

  1. Git

  2. Git

  3. on Mac: > brew install git on Ubuntu or some

    linux OS: > sudo apt-get install git-core or > sudo apt-get install git
  4. set your username and email > git config --global user.name

    "eddie" > git config --global user.email "[email protected]" list all settings > git config --list
  5. [alias] co = checkout br = branch aa = add

    --all l = "!source ~/.dotfiles/.githelper && pretty_git_log" https://github.com/kaochenlong/eddie-dotfiles
  6. Exercise: 1. set your username and email for git. 2.

    edit the ".gitconfig" and add some aliases.
  7. Exercise: try to check if "hello.rb" is in staging area,

    and then remove it from staging area.
  8. Exercise: in last commit, you forgot to add another file,

    but you don't want to commit again just for this single file, please try to commit it with -- amend.
  9. if you still want to commit an empty folder, you

    can put an empty “.gitkeep” file in it by convention.
  10. Exercise: 1. create a new branch name "fruit" 2. checkout

    to "fruit" branch 3. add a "banana.rb" and commit it
  11. Exercise: you just create a tag name “ncku”, try to

    checkout to this tag after several commits.
  12. Exercise: 1. checkout back to "master" branch 2. merge "fruit"

    to "master" 3. remove "fruit" branch if you like
  13. on Mac: > brew install git-flow on Ubuntu or some

    linux OS: > sudo apt-get install git-flow https://github.com/nvie/gitflow/wiki/Installation
  14. add a new feature: > git flow feature start my_new_feature

    when done with the new feature: > git flow feature finish my_new_feature
  15. Exercise: your boss ask you to add a new feature

    which can let user upload their photos, please try to finish this assignment in git flow.
  16. Exercise: your boss find a bug and ask you to

    fix it ASAP, please try to do this assignment in git flow.
  17. Exercise: 1. clone a project from Github 2. do some

    changes 3. commit and push back to Github
  18. Exercise: 1. create a new local branch 2. add some

    change and then push this branch to Github
  19. push a tag: > git push origin v2.0 push several

    tags: > git push origin --tags
  20. Exercise: 1. fork a project from your classmate who is

    sitting just next to you. 2. add some change and commit. 3. fire a pull request.
  21. Exercise: 1. create a github page for your account. 2.

    set your domain name in CNAME if you have one.