Git 基础
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Git 基础

on

  • 2,322 views

美团技术学院第三讲

美团技术学院第三讲

Statistics

Views

Total Views
2,322
Views on SlideShare
1,135
Embed Views
1,187

Actions

Likes
7
Downloads
42
Comments
0

11 Embeds 1,187

http://panweizeng.com 1108
http://www.panweizeng.com 30
http://xianguo.com 21
http://localhost 9
http://blog.shoproi.com 5
http://reader.youdao.com 5
http://static.slidesharecdn.com 2
http://theoldreader.com 2
http://node.panweizeng.com 2
http://pwz.im 2
http://xnny.net 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Git 基础 Presentation Transcript

  • 1. Git @
  • 2. Git•
  • 3. Git•• 2005 Linus Torvalds
  • 4. Git•• 2005 Linus Torvalds• the stupid content tracker
  • 5. Git•• 2005 Linus Torvalds• the stupid content tracker
  • 6. Git•
  • 7. Git••
  • 8. Git•••
  • 9. Git
  • 10. Git•
  • 11. Git••
  • 12. Git
  • 13. • blob - • tree - • commit -  tree• tag  - blob, tree commit commit
  • 14. • git clone git@cat.meituan.com:www• git clone git@cat.meituan.com:www mt
  • 15. • $git config --global user.name "john"• $git config --global user.email john@gmail.com
  • 16. • git add template/deal/default.php• git commit -m “update deal ui”
  • 17. • git push
  • 18. • git push• git push origin master
  • 19. • git status
  • 20. • git status• git status -s
  • 21. • git add• git reset HEAD• git checkout• git rm• git mv
  • 22. • git diff• git diff --cached• git diff HEAD• git diff origin
  • 23. • git log• git log -5• git log -p• git log -p --author=panweizeng• git log --since=2011-05-24• git log --until=2011-05-25• git log --name-only
  • 24. • git log --pretty=oneline• git log --pretty=format:%h:%s• git log --graph
  • 25. • git log --pretty=oneline• git log --pretty=format:%h:%s• git log --graph• fisheye http://www.atlassian.com/software/fisheye/
  • 26. • git pull
  • 27. • git pull• git fetch && git merge origin/master
  • 28. • git help command git help commit git help push git help log
  • 29. • Git
  • 30. • git branch hotfix• git checkout -b hotfix• git checkout -b hotfix master
  • 31. • git checkout hotfix• git checkout master
  • 32. • git merge hotfix• git merge origin/master• git merge --squash
  • 33. • git branch -v• git branch -d hotfix• git branch -D hotfix• git branch --merged• git branch --no-merged
  • 34. • git push origin abc #• git push origin :abc #• git branch -a #• git push origin panweizeng/abc• git push origin :panweizeng/abc
  • 35. •
  • 36. ••
  • 37. master
  • 38. masterdevelop
  • 39. masterdevelopmirror
  • 40. masterdevelopmirror
  • 41. masterdevelopmirror
  • 42. masterdevelopmirror
  • 43. master
  • 44. •
  • 45. • git config --global color.ui auto• git config --global alias.st status• git config core.filemode false• git config -l• /etc/gitconfig ~/.gitconfig .git/config
  • 46. HASH• git show c2bd66ee2f5ebef7dac171fca57875bd99f47318• git show c2bd66ee2f5ebef7• git show c2bd66ee• git show c2bd
  • 47. • git stash• git stash apply• git stash list• git stash branch abc
  • 48. • git grep keyword• git grep keyword -i -A10 -B10
  • 49. • git blame filename
  • 50. • git commit -m “new mobile”• git add forgotten_file• git commit --amend
  • 51. • git rebase -i 32cb53^• git commit --amend• git rebase --continue
  • 52. • git rebase -i 32cb53^• git commit --amend• git rebase --continue push
  • 53. diff• git diff > ~/diff # diff• git apply ~/diff # diff• patch -p1 < ~/diff # git
  • 54. [panweizeng@dev:mt(master)]$ git checkout developSwitched to branch develop[panweizeng@dev:mt(develop)]$ git checkout misSwitched to branch mis[panweizeng@dev:mt(mis)]$
  • 55. ~/.bashrcfunction parse_git_branch { git branch --no-color 2> /dev/null | sed -e /^[^*]/d -es/* (.*)/(1)/ -e s/((/(/ -e s/))/)/}function proml { local GREEN="[033[0;32m]" local COLOR_END="033[0m" PS1="[u@h:W$GREEN$(parse_git_branch)$COLOR_END]$ "}proml
  • 56. $cd ~/bin$curl -O https://github.com/git/git/raw/master/contrib/completion/git-completion.bash$curl -O https://github.com/bobthecow/git-flow-completion/raw/master/git-flow-completion.bash ~/.bashrcsource ~/bin/git-completion.bashsource ~/bin/git-flow-completion.bash
  • 57. $cd ~/bin$curl -O https://github.com/git/git/raw/master/contrib/completion/git-completion.bash$curl -O https://github.com/bobthecow/git-flow-completion/raw/master/git-flow-completion.bash ~/.bashrcsource ~/bin/git-completion.bashsource ~/bin/git-flow-completion.bash /etc/bash_completion.d/ /etc/profilefor i in /etc/bash_completion.d/* ; do if [ -r "$i" ]; then . $i fidone
  • 58. •
  • 59. ••
  • 60. ••• git
  • 61. The End• http://progit.org/book/zh
  • 62. The End• http://progit.org/book/zh