managing e commerce systems codebase with git

88
Managing E-commerce systems codebase with Git Bruno Ricardo Siqueira

Upload: bruno-ricardo-siqueira

Post on 16-Feb-2017

81 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Managing e commerce systems codebase with git

Managing E-commerce systems

codebase with Git

Bruno Ricardo Siqueira

Page 2: Managing e commerce systems codebase with git

About me

Bruno Ricardo Siqueira

Brazilian, working as Senior Software Developer at Smartbox, ~10 years of software development experience, PHP evangelist, Git lover, Rock N' Roll fan, Sci-fi addicted, MTG hobbyist player.

brunoric.infolinkedin.com/in/brunorictwitter.com/brunoricgithub.com/brunoric

Page 3: Managing e commerce systems codebase with git

● Motivation○ Why your E-commerce system need a VCS?○ Why Git?

● Git flows○ Why use or create a flow?○ Centralized workflow○ Feature branch workflow○ Gitflow workflow○ Forking workflow○ Dictator and lieutenants workflow

● Git features and tools

Agenda

Page 4: Managing e commerce systems codebase with git

Managing E-commerce systems codebase with Git

Motivation

Page 5: Managing e commerce systems codebase with git

Motivation

Why your E-commerce system need a VCS?

Page 6: Managing e commerce systems codebase with git
Page 7: Managing e commerce systems codebase with git

Motivation - Why your E-commerce system need a VCS?

Long-term change history of every file

Page 8: Managing e commerce systems codebase with git
Page 9: Managing e commerce systems codebase with git

Motivation - Why your E-commerce system need a VCS?

Traceability

Page 10: Managing e commerce systems codebase with git
Page 11: Managing e commerce systems codebase with git

Motivation - Why your E-commerce system need a VCS?

Branching and merging

Page 12: Managing e commerce systems codebase with git

Motivation - Why your E-commerce system need a VCS?

Page 13: Managing e commerce systems codebase with git

Motivation - Why your E-commerce system need a VCS?

Conflict resolution

Page 14: Managing e commerce systems codebase with git
Page 15: Managing e commerce systems codebase with git

Motivation - Why your E-commerce system need a VCS?

● Improve automation for daily tasks● Avoid code loss● Backup and restore strategy● Prototyping● Find when a specific bug or feature was introduced● …● Continuous integration and Continuous delivery

Page 16: Managing e commerce systems codebase with git

Motivation

Why Git?

Page 17: Managing e commerce systems codebase with git

Motivation - Why Git?

“I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git.”- Linus Torvalds

Page 18: Managing e commerce systems codebase with git

Motivation - Why Git?

Page 19: Managing e commerce systems codebase with git

Motivation - Why Git?

Page 20: Managing e commerce systems codebase with git

Motivation - Why Git?

Page 21: Managing e commerce systems codebase with git

Managing E-commerce systems codebase with Git

Git Flows

Page 22: Managing e commerce systems codebase with git

Git Flows

Why use or create a flow?

Page 23: Managing e commerce systems codebase with git

Git Flows - Why use or create a flow?

● With Git, branching and merging is cheap● Flows bring history consistency● Provide a logical way of reading the history● Facilitate automation● Facilitate new joiners ramp up● Avoid mistakes (unintended pushes, merges, unmerged branches, etc) ● ...

Page 24: Managing e commerce systems codebase with git

Git Flows

Centralized workflow

Page 25: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

● Like Subversion with benefits:○ developers have their

own local repository○ Git branches are

fail-safe○ Merge process is

painless

Page 26: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

Page 27: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

git push origin master

Page 28: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

Page 29: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

git push origin master

Page 30: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

git push origin master

Page 31: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

error: failed to push some refs to '/path/to/repo.git'hint: Updates were rejected because the tip of your current branch is behindhint: its remote counterpart. Merge the remote changes (e.g. 'git pull')hint: before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.git push origin master

Page 32: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

git pull --rebase origin master

Page 33: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

Page 34: Managing e commerce systems codebase with git

Git Flows - Centralized workflow

git add <some-file>git rebase --continuegit push origin master

Page 35: Managing e commerce systems codebase with git

Git Flows

Feature branch workflow

Page 36: Managing e commerce systems codebase with git

Git Flows - Feature branch workflow

Page 37: Managing e commerce systems codebase with git

Git Flows - Feature branch workflow

Page 38: Managing e commerce systems codebase with git

Git Flows - Feature branch workflow

Page 39: Managing e commerce systems codebase with git

Git Flows - Feature branch workflow

Page 40: Managing e commerce systems codebase with git

Git Flows - Feature branch workflow

Page 41: Managing e commerce systems codebase with git

Git Flows - Feature branch workflow

Page 42: Managing e commerce systems codebase with git

Git Flows - Feature branch workflow

Page 43: Managing e commerce systems codebase with git

Git Flows

Gitflow workflow

Page 44: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

Page 45: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

Page 46: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

Page 47: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

Page 48: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

Page 49: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

git clone ssh://user@host/path/to/repo.gitgit checkout -b develop origin/developgit checkout -b some-feature developgit statusgit add <some-file>git commit

Page 50: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

git pull origin developgit checkout developgit merge some-featuregit pushgit branch -d some-feature

Page 51: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

git checkout -b release-0.1 develop

Page 52: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

git checkout mastergit merge release-0.1git pushgit checkout developgit merge release-0.1git pushgit branch -d release-0.1

Page 53: Managing e commerce systems codebase with git

Git Flows - Gitflow workflow

git checkout mastergit merge release-0.1git pushgit checkout developgit merge release-0.1git pushgit branch -d release-0.1

Page 54: Managing e commerce systems codebase with git

Git Flows

Forking workflow

Page 55: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 56: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 57: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 58: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 59: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 60: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 61: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 62: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 63: Managing e commerce systems codebase with git

Git Flows - Forking workflow

Page 64: Managing e commerce systems codebase with git

Git Flows

Dictator and lieutenants workflow

Page 65: Managing e commerce systems codebase with git

Git Flows - Dictator and lieutenants workflow

Page 66: Managing e commerce systems codebase with git

Managing E-commerce systems codebase with Git

Git features and tools

Page 67: Managing e commerce systems codebase with git

Git features and tools

git loggit log [<options>] [<revision range>] [[\--] <path>…]

Page 68: Managing e commerce systems codebase with git

Git features and tools - git log

Page 69: Managing e commerce systems codebase with git

Git features and tools - git log

Page 70: Managing e commerce systems codebase with git

Git features and tools - git log

Page 71: Managing e commerce systems codebase with git

Git features and tools

git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] [-S[<keyid>]] <commit>…

git cherry-pick --continuegit cherry-pick --quitgit cherry-pick --abort

git cherry-pick

Page 72: Managing e commerce systems codebase with git

Git features and tools - git cherry-pick

Page 73: Managing e commerce systems codebase with git

Git features and tools

git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] [-S[<keyid>]] <commit>…

git cherry-pick --continuegit cherry-pick --quitgit cherry-pick --abort

git stash

Page 74: Managing e commerce systems codebase with git

Git features and tools - git stash

Page 75: Managing e commerce systems codebase with git

Git features and tools - git stash

Page 76: Managing e commerce systems codebase with git

Git features and tools - git stash

git stashgit checkout another-branchphpunit… # do some changes ...git stash [pop/apply]… # do another changes ...phpunit… # fix test issuesgit add -p… # do more fixesgit add .

Page 77: Managing e commerce systems codebase with git

Git features and tools

git bisect <subcommand> <options>

git bisect

Page 78: Managing e commerce systems codebase with git

Git features and tools - git bisect

git bisect startgit checkout BAD-POINTgit bisect badgit checkout GOOD-POINTgit bisect good

Page 79: Managing e commerce systems codebase with git

Git features and tools - git bisect

Page 80: Managing e commerce systems codebase with git

Git features and tools

What else?

Page 81: Managing e commerce systems codebase with git

Git features and tools - What else?

git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>…git revert --continuegit revert --quitgit revert --abort

git revert

Page 82: Managing e commerce systems codebase with git

Git features and tools - What else?

git apply [--stat] [--numstat] [--summary] [--check] [--index] [--3way] [--apply] [--no-add] [--build-fake-ancestor=<file>] [-R | --reverse] [--allow-binary-replacement | --binary] [--reject] [-z] [-p<n>] [-C<n>] [--inaccurate-eof] [--recount] [--cached] [--ignore-space-change | --ignore-whitespace] [--whitespace=(nowarn|warn|fix|error|error-all)] [--exclude=<path>] [--include=<path>] [--directory=<root>] [--verbose] [--unsafe-paths] [<patch>…]

git apply

Page 83: Managing e commerce systems codebase with git

Git features and tools - What else?

git hooks

Page 84: Managing e commerce systems codebase with git

Git features and tools - What else?

Page 85: Managing e commerce systems codebase with git

Managing E-commerce systems codebase with Git

Credits and reference

Page 86: Managing e commerce systems codebase with git

Git Flows - Credits and reference

● Tutorials, documentation and other presentations:○ A successful Git branching model - Vincent Driessen:

http://nvie.com/posts/a-successful-git-branching-model○ Atlassian Advanced Git Tutorials:

https://www.atlassian.com/git/tutorials/advanced-overview○ Git - Distributed Workflows:

https://git-scm.com/book/it/v2/Distributed-Git-Distributed-Workflows○ Git - Get Ready To Use It

http://www.slideshare.net/origamiaddict/git-get-ready-to-use-it ○ Git Tower:

https://www.git-tower.com/learn/git/ebook/en/command-line/appendix/from-subversion-to-git

Page 87: Managing e commerce systems codebase with git

Git Flows - Credits and reference

● Flow images:○ Atlassian: https://www.atlassian.com/git/tutorials○ Git SCM: https://git-scm.com/book

● Linus Torvalds image: http://news.softpedia.com/news/Linus-Torvalds-presents-a-new-software-management-configuration-system-1421.shtml

● Git bisect images: http://five.agency/cut-your-way-through-problems-with-git-bisecthttps://www.effectiveperlprogramming.com/wp-content/uploads/bisect1.png

● Git stash GIF: http://thecodinglove.com/post/151285532543/git-stash

● Git hook image:http://www.slideshare.net/PolishedGeek/git-hooked-using-git-hooks-to-improve-your-software-development-process

Page 88: Managing e commerce systems codebase with git

Managing E-commerce systems codebase with Git

Thanks!