Git-flow 사용 노트

13022 단어 git
git-flow원리: A successful Git branching model, 두 편의 괜찮은 중국어 번역: Git 개발 관리의 길,성공적인 Git 분기 모델.
간단하게 말하면git-flow는 git branchgit tag를 바탕으로 봉인된 코드 지점 관리 모델로 실제 개발을 시뮬레이션masterdevelopfeaturereleasehotfixsupportmaster 몇 가지 장면으로 만들었는데 그 중에서 develop는 출시되고 git branch는 개발에 대응하며 다른 몇 가지는 서로 다른 상황에서 나타난다.봉인을 통해git-flow는 git branch 등 상대적으로 복잡하고 딱딱한 명령(develop을 차단했고 특히 다분지 상황에서) 간단하고 규범화된 코드 분지 관리 문제를 해결했다.
git-flow를 설치합니다.
1

brew install git-flow

새 디렉토리에 git-flow 모델을 구축합니다.
1

2

3

4

5

6

7

8

9

10

11

12

➜ git flow init Initialized empty Git repository in /Users/fannheyward/flowTest/.git/ No branches exist yet. Base branches must be created now. Branch name for production releases: [master] Branch name for "next release" development: [develop] How to name your supporting branch prefixes? Feature branches? [feature/] Release branches? [release/] Hotfix branches? [hotfix/] Support branches? [support/] Version tag prefix? [] 

또는 기존 버전 라이브러리에서 작성:
1

2

3

4

5

6

7

8

9

10

11

12

➜ git flow init Which branch should be used for bringing forth production releases?  - master Branch name for production releases: [master] Branch name for "next release" development: [develop] How to name your supporting branch prefixes? Feature branches? [feature/] Release branches? [release/] Hotfix branches? [hotfix/] Support branches? [support/] Version tag prefix? [] 

중간에 생성된 지점 이름을 물어보고 바로 차로 돌아갑니다. 기본값입니다.이러한git-flow 분지 모델이 초기화되어 완성됩니다.
사용 장면1: 새로운 기능 개발, 대명 f1
1

2

3

4

5

6

7

8

9

10

➜ git flow feature start f1 Switched to a new branch 'feature/f1' Summary of actions: - A new branch 'feature/f1' was created, based on 'develop' - You are now on branch 'feature/f1' Now, start committing on your feature. When done, use:  git flow feature finish f1 

git-flow는 feature/f1 지점에서 새로운 지점 commit 을 만들고 이 지점 아래로 자동으로 전환합니다.그리고 f1기능 개발을 할 수 있고 중간에 여러 번feature/f1 조작을 할 수 있다.기능이 완료되면 다음을 수행합니다.
1

2

3

4

5

6

7

8

9

➜ git flow feature finish f1 Switched to branch 'develop' Already up-to-date. Deleted branch feature/f1 (was 7bb5749). Summary of actions: - The feature branch 'feature/f1' was merged into 'develop' - Feature branch 'feature/f1' has been removed - You are now on branch 'develop'
develop 분기의 코드는 develop에 통합된 다음에 이 분기를 삭제하고 develop로 전환합니다.여기까지, 새로운 기능 개발이 완료되었습니다.f1기능 개발에서 만약에 f1이 완성되지 않으면 동시에 기능 f2를 시작해도 된다.
사용장면2: 출시, 번호 0.1
1

2

3

4

5

6

7

8

9

10

11

12

13

➜ git flow release start 0.1 Switched to a new branch 'release/0.1' Summary of actions: - A new branch 'release/0.1' was created, based on 'develop' - You are now on branch 'release/0.1' Follow-up actions: - Bump the version number now! - Start committing last-minute fixes in preparing your release - When done, run:  git flow release finish '0.1'

git-flow는 release/0.1 지점에서 새로운 지점master을 만들고 이 지점 아래로 전환합니다. 다음은 버전 번호 수정 등 발표 작업입니다.완료 후:
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

➜ git flow release finish 0.1 Switched to branch 'master' Merge made by the 'recursive' strategy.  f1 | 1 +  version | 1 +  2 files changed, 2 insertions(+)  create mode 100644 f1  create mode 100644 version Switched to branch 'develop' Merge made by the 'recursive' strategy.  version | 1 +  1 file changed, 1 insertion(+)  create mode 100644 version Deleted branch release/0.1 (was d77df80). Summary of actions: - Latest objects have been fetched from 'origin' - Release branch has been merged into 'master' - The release was tagged '0.1' - Release branch has been back-merged into 'develop' - Release branch 'release/0.1' has been deleted

git-flow는 순서대로 developrelease/0.1에서 합병git tag의 수정을 전환한 후 git tag로 이번 발표에 tag 0.1을 표시하고 master를 통해 모든 tag를 볼 수 있습니다.
1

2

3

➜ git:(master) git tag 0.1 0.2

사용 장면3: 긴급 버그 수정, 대명 버그1
1

2

3

4

5

6

7

8

9

10

11

12

13

➜ git flow hotfix start bug1 Switched to a new branch 'hotfix/bug1' Summary of actions: - A new branch 'hotfix/bug1' was created, based on 'master' - You are now on branch 'hotfix/bug1' Follow-up actions: - Bump the version number now! - Start committing your hot fixes - When done, run:  git flow hotfix finish 'bug1'

git-flow는 hotfix/bug1 지점에서 새로운 지점 master 을 만들고 이 지점 아래로 전환합니다.다음은 버그를 복구하는 것입니다. 완료 후:
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

➜ git flow hotfix finish bug1 Switched to branch 'master' Merge made by the 'recursive' strategy.  f1 | 2 +-  1 file changed, 1 insertion(+), 1 deletion(-) Switched to branch 'develop' Merge made by the 'recursive' strategy.  f1 | 2 +-  1 file changed, 1 insertion(+), 1 deletion(-) Deleted branch hotfix/bug1 (was aa3ca2e). Summary of actions: - Latest objects have been fetched from 'origin' - Hotfix branch has been merged into 'master' - The hotfix was tagged 'bug1' - Hotfix branch has been back-merged into 'develop' - Hotfix branch 'hotfix/bug1' has been deleted

git-flow는 순서대로 develophotfix/bug1 지점에서 합병hotfix/bug1으로 전환하고 삭제feature한다.여기까지hotfix가 완성되었습니다.
git-flow의 releasedevelop는 모두 hotfix지점에서 창설되었고 supportmaster지점에서 창설되었다.
출처:http://fann.im/blog/2012/03/12/git-flow-notes/

좋은 웹페이지 즐겨찾기