40
Workflow and Advanced Tips CODETO@2015/11/09

Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Embed Size (px)

Citation preview

Page 1: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Workflow and Advanced Tips

CODETO@2015/11/09

Page 2: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

GIT OVERVIEWWORKFLOWBENGO4 WORKINGADVANCED TIPS

Trung tâm lập trình CODETO@2015/11/09

Page 3: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

GIT

Trung tâm lập trình CODETO@2015/11/09

Page 4: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 5: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 6: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 7: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 8: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

DEVELOPMENT

o Reflects the latest development

TESTING/STAGING

o Code is deployed to testing/staging environment

MASTER

o Code is deployed to production

Trung tâm lập trình CODETO@2015/11/09

Page 9: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 10: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 11: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 12: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 13: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 14: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 15: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 16: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 17: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 18: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 19: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 20: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 21: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 22: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 23: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 24: Git workflow advanced - Trung tâm lập trình Codeto Vietnam
Page 25: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 26: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 27: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Trung tâm lập trình CODETO@2015/11/09

Page 28: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

BENGO4 (in practice)

Trung tâm lập trình CODETO@2015/11/09

Page 29: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

BENGO4 (in practice)

Trung tâm lập trình CODETO@2015/11/09

Page 30: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

ADVANCED TIPS

Merge vs Rebase

Reset/Checkout/Revert

Git Log

Trung tâm lập trình CODETO@2015/11/09

Page 31: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

ADVANCED TIPS

Merge vs Rebase

Reset/Checkout/Revert

Git Log

Page 32: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Merge vs Rebase

Merge• git checkout feature • git merge master

Trung tâm lập trình CODETO@2015/11/09

Page 33: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Merge vs Rebase

Rebase• git checkout feature • git rebase master

Trung tâm lập trình CODETO@2015/11/09

Page 34: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Merge vs Rebase

MergeEasy & SimpleNew merge-commitMess history

RebaseDangerous & FlexibleMove all commits to HEADNatural history

Dangerous rebase• Never rebase on master branch• About to re-base a public branch (pushed)? Anyone are working on?• Don’t sure – don’t use

Page 35: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Reset/Checkout/RevertReset• Remove commits in current branch• Move HEAD to PREVIOUS commits in local repo

Trung tâm lập trình CODETO@2015/11/09

Page 36: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Reset/Checkout/RevertReset• Soft• Mixed• Hard

Trung tâm lập trình CODETO@2015/11/09

Page 37: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Reset/Checkout/RevertCheckout• Switch branches• Bring changes from another branch• Back to previous commit

Trung tâm lập trình CODETO@2015/11/09

Page 38: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Reset/Checkout/RevertRevert• Safe way to undo changes• Create new commits for roll-back commits

Trung tâm lập trình CODETO@2015/11/09

Page 39: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

Git loggit log (useful in command line)• --oneline (display in single line)• --decorate (display in branches point to each commit)• shortlog (display short,readable commits group by author)• --graph --oneline –decorate (draw graph in cli)• --pretty=format:"%cn committed %h on %cd“ (custom log format)• -<number> (most recent commits)• --after="2014-7-1“--before="2014-7-4“ (after and before)• --author="John“ (filter by author)• -- <file>• --<branch a>..<branch b>• …

Trung tâm lập trình CODETO@2015/11/09

Page 40: Git workflow advanced - Trung tâm lập trình Codeto Vietnam

SUMMARY

Great workflow and collaboration!

Powerful branching & merging

Fast and smaller than ever before ..

Local repo - network out, everything still fine…

Trung tâm lập trình CODETO@2015/11/09