Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
Learning Git
Slide 2
Slide 2 text
YouMeb 悠邁科技 Senior Web Developer & AngularJS Guru I am Blue
Slide 3
Slide 3 text
國中生活 Why git? Learning git
Slide 4
Slide 4 text
1. 想知道別人在昨天修改了哪些地方 2.產品有版本控管需求 3.為了參加零時政府
Slide 5
Slide 5 text
國中生活 github introdution Learning git
Slide 6
Slide 6 text
github.com
Slide 7
Slide 7 text
No content
Slide 8
Slide 8 text
國中生活 git good part Learning git
Slide 9
Slide 9 text
1. git clone https/git@ 承接專案
Slide 10
Slide 10 text
1. git add . 2. git commit -am ‘bla..’ 3. git pull 4. git push
Slide 11
Slide 11 text
1. git add . git status 檢查改了什麼 2. git commit -am ‘bla..’ 3. git pull 4. git push
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
國中生活 Branch的概念 Learning git
Slide 14
Slide 14 text
No content
Slide 15
Slide 15 text
1. git branch 查看所在分支 2. git checkout -b ‘test’ 新增test分支 3. git checkout test 跳到test分支去
Slide 16
Slide 16 text
git merge ‘分支名稱’ 把別人做的東西抓進來 But..........
Slide 17
Slide 17 text
直接merge會在這條線上看不到分支記錄 因此要用git merge --no-ff
Slide 18
Slide 18 text
你做的分支,也可以丟github git push origin ‘分支名’
Slide 19
Slide 19 text
國中生活 git log Learning git
Slide 20
Slide 20 text
HEAD^ HEAD~1 HEAD~2 HEAD~3 HEAD~4 注意!HEAD是最前面 mac : HEAD\^
Slide 21
Slide 21 text
git log --stat 顯示每次commit的東西
Slide 22
Slide 22 text
git log -p -2 顯示每次commit的東西的詳情 (程式碼,最近兩次) http://git-scm.com/book/zh/Git-%E5%9F%BA%E7%A1%80-%E6%9F%A5%E7%9C %8B%E6%8F%90%E4%BA%A4%E5%8E%86%E5%8F%B2
Slide 23
Slide 23 text
國中生活 當然...你也可以客製化git log Learning git
Slide 24
Slide 24 text
git log --graph -- pretty=format:'%s - %Cred %h%Creset %Cgreen(%cr) %Creset %an' --abbrev- commit --date=relative try that: https://hisea.me/p/git-log-output-formats
Slide 25
Slide 25 text
國中生活 使用上述常見問題 Learning git
Slide 26
Slide 26 text
從別人那邊clone,卻推不上github
Slide 27
Slide 27 text
1. vim .git -> 選擇config 檢查⼀一下路徑
Slide 28
Slide 28 text
conflict ?!
Slide 29
Slide 29 text
我要還原!! git reset --hard HEAD(版本)
Slide 30
Slide 30 text
盡量少用rebase ,reset 請用開分支的方式還原某階段的commit http://ihower.tw/git/rebase.html
Slide 31
Slide 31 text
阿!!!.... commit 註解寫錯了怎麼辦?
Slide 32
Slide 32 text
先reset到那個版本,再改commit 1. git reset --soft HEAD\^ 2. git commit -a -c ORIG_HEAD
Slide 33
Slide 33 text
git cherry-pick ‘commit 代碼’ 我要不要合併branch 只要合併commit? git cherry-pick -n ‘commit 代碼’
Slide 34
Slide 34 text
國中生活 git flow / feature branch Learning git
Slide 35
Slide 35 text
http://blog.wu-boy.com/2011/03/git-%E7%89%88%E6%9C%AC%E6%8E %A7%E5%88%B6-branch-model-%E5%88%86%E6%94%AF %E6%A8%A1%E7%B5%84%E5%9F%BA%E6%9C%AC%E4%BB%8B %E7%B4%B9/ http://nvie.com/posts/a-successful-git-branching-model/ 實戰ref: See:
Slide 36
Slide 36 text
THANKYOU. FOR YOUR ATTENTION www.facebook.com/iambluechen