Git      @
Git•
Git•• 2005   Linus Torvalds
Git•• 2005 Linus Torvalds• the stupid content tracker
Git•• 2005 Linus Torvalds• the stupid content tracker
Git•
Git••
Git•••
Git
Git•
Git••
Git
• blob - • tree - • commit -   tree• tag  -       blob, tree  commit      commit
• git clone git@cat.meituan.com:www• git clone git@cat.meituan.com:www mt
•   $git config --global user.name "john"•   $git config --global user.email john@gmail.com
• git add template/deal/default.php• git commit -m “update deal ui”
• git push
• git push• git push origin master
• git status
• git status• git status -s
• git add• git reset HEAD• git checkout• git rm• git mv
• git diff• git diff --cached• git diff HEAD• git diff origin
• 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 --pretty=oneline• git log --pretty=format:%h:%s• git log --graph
• git log --pretty=oneline• git log --pretty=format:%h:%s• git log --graph• fisheye  http://www.atlassian.com/software/fishe...
• git pull
• git pull• git fetch && git merge origin/master
• git help command  git help commit  git help push  git help log
• Git
• git branch hotfix• git checkout -b hotfix• git checkout -b hotfix master
• git checkout hotfix• git checkout master
• git merge hotfix• git merge origin/master• git merge --squash
• git branch -v• git branch -d hotfix• git branch -D hotfix• git branch --merged• git branch --no-merged
• git push origin abc #• git push origin :abc #• git branch -a #• git push origin panweizeng/abc• git push origin :panweiz...
•
••
master
masterdevelop
masterdevelopmirror
masterdevelopmirror
masterdevelopmirror
masterdevelopmirror
master
•
•   git config --global color.ui auto•   git config --global alias.st status•   git config core.filemode false•   git config -l...
HASH•   git show c2bd66ee2f5ebef7dac171fca57875bd99f47318•   git show c2bd66ee2f5ebef7•   git show c2bd66ee•   git show c2bd
• git stash• git stash apply• git stash list• git stash branch abc
• git grep keyword• git grep keyword -i -A10 -B10
• git blame filename
• git commit -m “new mobile”• git add forgotten_file• git commit --amend
• git rebase -i 32cb53^• git commit --amend• git rebase --continue
• git rebase -i 32cb53^• git commit --amend• git rebase --continue                     push
diff• git diff > ~/diff #       diff• git apply ~/diff # diff• patch -p1 < ~/diff #             git
[panweizeng@dev:mt(master)]$ git checkout developSwitched to branch develop[panweizeng@dev:mt(develop)]$ git checkout misS...
~/.bashrcfunction parse_git_branch {    git branch --no-color 2> /dev/null | sed -e /^[^*]/d -es/* (.*)/(1)/ -e s/((/(/ -e...
$cd ~/bin$curl -O https://github.com/git/git/raw/master/contrib/completion/git-completion.bash$curl -O https://github.com/...
$cd ~/bin$curl -O https://github.com/git/git/raw/master/contrib/completion/git-completion.bash$curl -O https://github.com/...
•
••
•••   git
The End• http://progit.org/book/zh
The End• http://progit.org/book/zh
Git 基础
Git 基础
Git 基础
Git 基础
Git 基础
Git 基础
Git 基础
Git 基础
Git 基础
Git 基础
Git 基础
Git 基础
Upcoming SlideShare
Loading in...5
×

Git 基础

2,360

Published on

美团技术学院第三讲

Published in: Technology, Business
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,360
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
46
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

Git 基础

  1. 1. Git @
  2. 2. Git•
  3. 3. Git•• 2005 Linus Torvalds
  4. 4. Git•• 2005 Linus Torvalds• the stupid content tracker
  5. 5. Git•• 2005 Linus Torvalds• the stupid content tracker
  6. 6. Git•
  7. 7. Git••
  8. 8. Git•••
  9. 9. Git
  10. 10. Git•
  11. 11. Git••
  12. 12. Git
  13. 13. • blob - • tree - • commit -  tree• tag  - blob, tree commit commit
  14. 14. • git clone git@cat.meituan.com:www• git clone git@cat.meituan.com:www mt
  15. 15. • $git config --global user.name "john"• $git config --global user.email john@gmail.com
  16. 16. • git add template/deal/default.php• git commit -m “update deal ui”
  17. 17. • git push
  18. 18. • git push• git push origin master
  19. 19. • git status
  20. 20. • git status• git status -s
  21. 21. • git add• git reset HEAD• git checkout• git rm• git mv
  22. 22. • git diff• git diff --cached• git diff HEAD• git diff origin
  23. 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. 24. • git log --pretty=oneline• git log --pretty=format:%h:%s• git log --graph
  25. 25. • git log --pretty=oneline• git log --pretty=format:%h:%s• git log --graph• fisheye http://www.atlassian.com/software/fisheye/
  26. 26. • git pull
  27. 27. • git pull• git fetch && git merge origin/master
  28. 28. • git help command git help commit git help push git help log
  29. 29. • Git
  30. 30. • git branch hotfix• git checkout -b hotfix• git checkout -b hotfix master
  31. 31. • git checkout hotfix• git checkout master
  32. 32. • git merge hotfix• git merge origin/master• git merge --squash
  33. 33. • git branch -v• git branch -d hotfix• git branch -D hotfix• git branch --merged• git branch --no-merged
  34. 34. • git push origin abc #• git push origin :abc #• git branch -a #• git push origin panweizeng/abc• git push origin :panweizeng/abc
  35. 35.
  36. 36. ••
  37. 37. master
  38. 38. masterdevelop
  39. 39. masterdevelopmirror
  40. 40. masterdevelopmirror
  41. 41. masterdevelopmirror
  42. 42. masterdevelopmirror
  43. 43. master
  44. 44.
  45. 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. 46. HASH• git show c2bd66ee2f5ebef7dac171fca57875bd99f47318• git show c2bd66ee2f5ebef7• git show c2bd66ee• git show c2bd
  47. 47. • git stash• git stash apply• git stash list• git stash branch abc
  48. 48. • git grep keyword• git grep keyword -i -A10 -B10
  49. 49. • git blame filename
  50. 50. • git commit -m “new mobile”• git add forgotten_file• git commit --amend
  51. 51. • git rebase -i 32cb53^• git commit --amend• git rebase --continue
  52. 52. • git rebase -i 32cb53^• git commit --amend• git rebase --continue push
  53. 53. diff• git diff > ~/diff # diff• git apply ~/diff # diff• patch -p1 < ~/diff # git
  54. 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. 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. 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. 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. 58.
  59. 59. ••
  60. 60. ••• git
  61. 61. The End• http://progit.org/book/zh
  62. 62. The End• http://progit.org/book/zh
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×