Top Banner
Git and Git-Flow M.M.H.Masud Programmer at Granbury Solutions [email protected]
20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Gitt and Git-flow

Git and Git-FlowM.M.H.Masud

Programmer at Granbury [email protected]

Page 2: Gitt and Git-flow

what we need for Git? (review)

1. Git installation in Windows2. Git Installation in Linux & Mac3. Git Bash for windows user4. Terminal for Linux & Mac User

Page 3: Gitt and Git-flow

Git and Git-bash in Windows

Installation:● Goto the link http://git-scm.com/download/win● Install and follow the steps with default settings● after installation open git-bash (start->All programs-

>git->Git Bash)● Command line window will appear.● type "git --version", it will show you the current git

version

Page 4: Gitt and Git-flow

Git and Git-bash in Windows

Git-Bash:

Page 5: Gitt and Git-flow

Git in Linux/Mac

1. Linux: type "sudo apt-get install git" in shell

2. Mac User: brew Install git

Page 6: Gitt and Git-flow

Git-Flow in windows1. got to Git Bash 2. type "git clone --recursive git://github.com/nvie/gitflow.git"3. now close git bash.4. type "cmd" in start menu and then press Ctrl+shif+enter on Cmd

icon to open it in administrative mode. 5. goto git-flow directory like: C:\gitflow6. type "contrib/msysgit-install.cmd"7. it will install git-flow8. now open git bash again and type git-flow9. you will see list of option for git-flow

10. all done. Ready to start with git-flow

Page 7: Gitt and Git-flow

Git-Flow in Linux/Macinstalling git-flow in Linux: ===========================type "sudo apt-get install git-flow" and all done

installing git-flow in Mac:===========================brew install git-flow

Page 8: Gitt and Git-flow
Page 9: Gitt and Git-flow

SSh Key add in BitbucketWindows:

- open git-bash- Type “ssh-keygen -t rsa

"[email protected]"- Follow the steps- once generated, open the file: “cat ~/.

ssh/id_rsa.pub”- copy the content- add the key to bitbucket (manage

account -> ssh keys -> add key)- Done.

Linux/Mac:- open Terminal- Type “ssh-keygen -t rsa

"[email protected]"- Follow the steps- once generated, open the file: “cat ~/.

ssh/id_rsa.pub”- copy the content- add the key to bitbucket (manage account

-> ssh keys -> add key)- Done.

Page 10: Gitt and Git-flow

Git-Flow InitPrerequisite

- a repository needs to be a git repository

- master branch needs to be available in Bitbucket and local

Start Git-flow:- “git-flow init” command needs to

be run- it will create a ‘develop’ branch

from master branch.- push the ‘develop’ branch to

bitbucket.

Ready to use Git-flow

Page 11: Gitt and Git-flow

Git-Flow Tools

SourceTree for Mac and Windows. (picture: SourceTree)SmartSVN for Linux (non-commercial is free).

Page 12: Gitt and Git-flow

Git-Flow Master Branch

Development Branch

Feature Branch

TPOS-101

TPOS-101

TPOS-101

TPOS-101

Release Branch

release-v.1.0

release-v.2.0

Hotfix Branch

rel-1.0-hotfix-TPOS-200

rel-1.0-hotfix-TPOS-200

Page 13: Gitt and Git-flow

How Git-Flow Works

Page 14: Gitt and Git-flow

Git-Flow Featuregit-flow feature start TPOS-101

- start a branch from development branch

git-flow feature finished TPOS-100- merge the branch with

Development branch

git-flow feature finished -k TPOS-100- -k : will not delete the branch

after finish.

git-flow feature publish TPOS-100- push the branch to git

DEVELOPERFor any kind of JIRA ticket we will

create a Feature branch

Page 15: Gitt and Git-flow

Git-Flow Releasegit-flow release start release-v.1.0

- start a branch from development branch

git-flow release finished release-v.1.0- merge the branch with

Development branch- merge branch with master

branchgit-flow release finished -k release-v.1.0

- -k : will not delete the branch after finish.

git-flow release publish release-v.1.0- push the branch to git

RELEASE MANAGER

Page 16: Gitt and Git-flow

If Release branch has bug?1. check out release-v.1.0 in

local2. create branch using GIT

(NOT git-flow) ex: rel-v.1.0-TPOS-201

3. Fix the bug4. Merge the branch with your

local release branch release-v.1.0.

5. if ok, push the branch rel-v.1.0-TPOS-201 in Bitbucket

Next: - Create a Pull Request in

Bitbucket with release-v.1.0

Page 17: Gitt and Git-flow

Release v.1.0 Test done. Next???1. Finish the Release v.1.02. it will merge release v.1.0

branch with local develop and master branch.

3. check everything in local4. Push both branch in

Bitbucket. 5. Tag the branch for future

reference (most important)

- check everything in Master branch (http://staging.grspos.net).

- If everything works fine, make the release for production.

Page 18: Gitt and Git-flow

If Production has bug? :(

Production related bug fix is commonly known as HOTFIX

andGIT-FLOW manage it by himself

git-flow hotfix start rel-1.0-hotfix-TPOS-301

- create branch from mastergit-flow hotfix publish rel-1.0-hotfix-TPOS-301

- push the branch in Bitbucketgit-flow hotfix finish rel-1.0-hotfix-TPOS-301

- merge with develop- merge with master

Page 19: Gitt and Git-flow

Hotfix Workflow- Create hotfix branch using git-

flow- publish the hotfix branch

using git-flow publish- finish hotfix branch using git-

flow- check everything in local- once everything is working

fine, create two pull request to develop & master branch using bitbucket, like release branch.

- Release master review pull request, and merge it with master and develop.

NOTE: Don’t push Develop and master

branch from local after hotfix finish

Page 20: Gitt and Git-flow

Future & QA

- Create Git-Hook for Pre-commit and POST-Commit

- Update Dev, Testing and Staging server automatically using bitbucket and git-hook