managing e commerce systems codebase with git

Post on 16-Feb-2017

81 Views

Category:

Software

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Managing E-commerce systems

codebase with Git

Bruno Ricardo Siqueira

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

● 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

Managing E-commerce systems codebase with Git

Motivation

Motivation

Why your E-commerce system need a VCS?

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

Long-term change history of every file

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

Traceability

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

Branching and merging

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

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

Conflict resolution

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

Motivation

Why Git?

Motivation - Why Git?

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

Motivation - Why Git?

Motivation - Why Git?

Motivation - Why Git?

Managing E-commerce systems codebase with Git

Git Flows

Git Flows

Why use or create a flow?

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) ● ...

Git Flows

Centralized workflow

Git Flows - Centralized workflow

● Like Subversion with benefits:○ developers have their

own local repository○ Git branches are

fail-safe○ Merge process is

painless

Git Flows - Centralized workflow

Git Flows - Centralized workflow

git push origin master

Git Flows - Centralized workflow

Git Flows - Centralized workflow

git push origin master

Git Flows - Centralized workflow

git push origin master

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

Git Flows - Centralized workflow

git pull --rebase origin master

Git Flows - Centralized workflow

Git Flows - Centralized workflow

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

Git Flows

Feature branch workflow

Git Flows - Feature branch workflow

Git Flows - Feature branch workflow

Git Flows - Feature branch workflow

Git Flows - Feature branch workflow

Git Flows - Feature branch workflow

Git Flows - Feature branch workflow

Git Flows - Feature branch workflow

Git Flows

Gitflow workflow

Git Flows - Gitflow workflow

Git Flows - Gitflow workflow

Git Flows - Gitflow workflow

Git Flows - Gitflow workflow

Git Flows - Gitflow workflow

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

Git Flows - Gitflow workflow

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

Git Flows - Gitflow workflow

git checkout -b release-0.1 develop

Git Flows - Gitflow workflow

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

Git Flows - Gitflow workflow

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

Git Flows

Forking workflow

Git Flows - Forking workflow

Git Flows - Forking workflow

Git Flows - Forking workflow

Git Flows - Forking workflow

Git Flows - Forking workflow

Git Flows - Forking workflow

Git Flows - Forking workflow

Git Flows - Forking workflow

Git Flows - Forking workflow

Git Flows

Dictator and lieutenants workflow

Git Flows - Dictator and lieutenants workflow

Managing E-commerce systems codebase with Git

Git features and tools

Git features and tools

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

Git features and tools - git log

Git features and tools - git log

Git features and tools - git log

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

Git features and tools - git cherry-pick

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

Git features and tools - git stash

Git features and tools - git stash

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 .

Git features and tools

git bisect <subcommand> <options>

git bisect

Git features and tools - git bisect

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

Git features and tools - git bisect

Git features and tools

What else?

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

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

Git features and tools - What else?

git hooks

Git features and tools - What else?

Managing E-commerce systems codebase with Git

Credits and reference

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

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

Managing E-commerce systems codebase with Git

Thanks!

top related