Upload
ha-anh-son
View
211
Download
1
Embed Size (px)
Citation preview
Workflow and Advanced Tips
CODETO@2015/11/09
GIT OVERVIEWWORKFLOWBENGO4 WORKINGADVANCED TIPS
Trung tâm lập trình CODETO@2015/11/09
GIT
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
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
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
Trung tâm lập trình CODETO@2015/11/09
BENGO4 (in practice)
Trung tâm lập trình CODETO@2015/11/09
BENGO4 (in practice)
Trung tâm lập trình CODETO@2015/11/09
ADVANCED TIPS
Merge vs Rebase
Reset/Checkout/Revert
Git Log
Trung tâm lập trình CODETO@2015/11/09
ADVANCED TIPS
Merge vs Rebase
Reset/Checkout/Revert
Git Log
Merge vs Rebase
Merge• git checkout feature • git merge master
Trung tâm lập trình CODETO@2015/11/09
Merge vs Rebase
Rebase• git checkout feature • git rebase master
Trung tâm lập trình CODETO@2015/11/09
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
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
Reset/Checkout/RevertReset• Soft• Mixed• Hard
Trung tâm lập trình CODETO@2015/11/09
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
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
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
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