ćœŹć–‡ĺŽšä˝äşŽä¸şä˝żç”¨GITć ‡ĺ‡†ĺˆ†ć”Żĺź€ĺ‘ćľç¨‹çš„埀ĺ‘ĺ›˘é˜Ÿć–°äşşć䞛一䝽ĺ‚č€ƒćŒ‡ĺ—ďźŒĺ…śä¸çš„ĺ†…ĺŽšéƒ˝ć˜Żćˆ‘äťŹĺ…Źĺ¸ĺœ¨ç ”ĺ‘ĺ›˘é˜Ÿĺˆĺˆ›ć—ść‰€éľĺžŞçš„一些埀ĺ‘ćľç¨‹ć ‡ĺ‡†ďźŒçťčż‡čż‘ä¸€ĺš´çš„ĺŽžčˇľďźŒč™˝čŻ´čż˜ćœ‰ĺžˆĺ¤šä¸čśłďźŒä˝†ć˜Żéšç€ĺ›˘é˜ŸçťéŞŒçš„ä¸°ĺŻŒĺ’Œäşşĺ‘˜çš„ć‰Šĺź ďźŒćˆ‘äźšé€‚ć—śĺœ°ć›´ć–°ćœŹć–‡ďźŒĺˆ†äşŤćˆ‘äťŹĺœ¨ä˝żç”¨GIT埀ĺ‘ćľç¨‹ä¸é‡ĺˆ°çš„é—Žé˘˜ĺ’Œč§Łĺ†łć–šćĄˆă€‚
饚盎ä¸é•żćœŸĺ˜ĺœ¨çš„ä¸¤ä¸Şĺˆ†ć”Ż
master
ďźšä¸ťĺˆ†ć”ŻďźŒč´Ÿč´ŁčŽ°ĺ˝•ä¸Šçşżç‰ˆćœŹçš„čżäťŁďźŒčŻĽĺˆ†ć”ŻäťŁç 与线上䝣ç ć˜ŻĺŽŒĺ…¨ä¸€č‡´çš„ă€‚develop
埀ĺ‘ĺˆ†ć”ŻďźŒčŻĽĺˆ†ć”ŻčŽ°ĺ˝•ç›¸ĺŻšç¨łĺŽšçš„ç‰ˆćœŹďźŒć‰€ćœ‰çš„featureĺˆ†ć”Żĺ’Œbugfixĺˆ†ć”Żéƒ˝äťŽčŻĽĺˆ†ć”Żĺˆ›ĺťşă€‚ĺ…śĺŽƒĺˆ†ć”Żä¸şçŸćœŸĺˆ†ć”ŻďźŒĺ…śĺŽŒćˆĺŠŸčƒ˝ĺź€ĺ‘äš‹ĺŽéœ€čŚĺˆ 除
feature/*
ďźšç‰šć€§ďźˆĺŠŸčƒ˝ďź‰ĺˆ†ć”ŻďźŒç”¨äşŽĺź€ĺ‘ć–°çš„ĺŠŸčƒ˝ďźŒä¸ĺŒçš„ĺŠŸčƒ˝ĺˆ›ĺťşä¸ĺŒçš„ĺŠŸčƒ˝ĺˆ†ć”ŻďźŒĺŠŸčƒ˝ĺˆ†ć”Żĺź€ĺ‘ĺŽŒćˆĺšśč‡Şćľ‹é€ščż‡äš‹ĺŽďźŒéœ€čŚĺˆĺšśĺˆ° develop ĺˆ†ć”ŻďźŒäš‹ĺŽĺˆ é™¤čŻĽĺˆ†ć”Żă€‚bugfix/*
ďźšbug俎ĺ¤ĺˆ†ć”ŻďźŒç”¨äşŽäżŽĺ¤ä¸ç´§ć€Ľçš„bugďźŒć™Žé€šbugĺ‡éœ€čŚĺˆ›ĺťşbugfixĺˆ†ć”Żĺź€ĺ‘ďźŒĺź€ĺ‘ĺŽŒćˆč‡Şćľ‹ć˛Ąé—Žé˘˜ĺŽĺˆĺšśĺˆ° develop ĺˆ†ć”ŻĺŽďźŒĺˆ é™¤čŻĽĺˆ†ć”Żă€‚release/*
ďźšĺ‘ĺ¸ƒĺˆ†ć”ŻďźŒç”¨äşŽäťŁç ä¸Šçşżĺ‡†ĺ¤‡ďźŒčŻĽĺˆ†ć”ŻäťŽdevelopĺˆ†ć”Żĺˆ›ĺťşďźŒĺˆ›ĺťşäš‹ĺŽç”ąćľ‹čŻ•ĺŒĺŚĺ‘ĺ¸ƒĺˆ°ćľ‹čŻ•çŽŻĺ˘ƒčż›čĄŒćľ‹čŻ•ďźŒćľ‹čŻ•čż‡ç¨‹ä¸ĺ‘现bug需čŚĺź€ĺ‘äşşĺ‘˜ĺœ¨čŻĽreleaseĺˆ†ć”Żä¸Ščż›čĄŒbug俎ĺ¤ďźŒć‰€ćœ‰bug俎ĺ¤ĺŽŒĺŽďźŒĺœ¨ä¸Šçşżäš‹ĺ‰ďźŒéœ€čŚĺˆĺšśčŻĽreleaseĺˆ†ć”Żĺˆ°masterĺˆ†ć”Żĺ’Œdevelopĺˆ†ć”Żă€‚hotfix/*
紧怼bug俎ĺ¤ĺˆ†ć”ŻďźŒčŻĽĺˆ†ć”ŻĺŞćœ‰ĺœ¨ç´§ć€Ľćƒ…ĺ†ľä¸‹ä˝żç”¨ďźŒäťŽmasterĺˆ†ć”Żĺˆ›ĺťşďźŒç”¨äşŽç´§ć€ĽäżŽĺ¤çşżä¸ŠbugďźŒäżŽĺ¤ĺŽŒćˆĺŽďźŒéœ€čŚĺˆĺšśčŻĽĺˆ†ć”Żĺˆ°masterĺˆ†ć”ŻäťĽäžżä¸ŠçşżďźŒĺŒć—śéœ€čŚĺ†ĺˆĺšśĺˆ°developĺˆ†ć”Żă€‚ĺŠŸčƒ˝ĺˆ†ć”Żçš„ĺˆ†ć”Żĺç§°ĺş”čŻĽä¸şčƒ˝ĺ¤Ÿĺ‡†çĄŽćčż°čŻĽĺŠŸčƒ˝çš„č‹ąć–‡çŽ€čŚčĄ¨čż°
feature/ĺˆ†ć”Żĺ称
äž‹ĺŚ‚ďźŒĺź€ĺ‘çš„ĺŠŸčƒ˝ä¸ş 新增商ĺ“ĺˆ°ç‰Šć–™ĺş“ďźŒĺˆ™ĺŻäťĽĺˆ›ĺťşĺ称为 feature/material-add
çš„ĺˆ†ć”Żă€‚
bug俎ĺ¤ĺˆ†ć”Żçš„ĺˆ†ć”Żĺ称ĺŻäťĽä¸şJiraä¸bug䝣ç ćˆ–č€…ć˜Żć述诼bug的苹文玀称
bugfix/ĺˆ†ć”Żĺ称 hotfix/ĺˆ†ć”Żĺ称
ćŻ”ĺŚ‚ďźŒäżŽĺ¤çš„bugĺœ¨jiraä¸äťŁĺˇä¸şMATERIAL-1ďźŒĺˆ™ĺŻäťĽĺˆ›ĺťşä¸€ä¸Şĺ为bugfix/MATERIAL-1
çš„ĺˆ†ć”Żă€‚
releaseĺˆ†ć”Żä¸şé˘„ĺ‘ĺ¸ƒĺˆ†ć”ŻďźŒĺ‘˝ĺä¸şćœŹćŹĄĺ‘ĺ¸ƒçš„ä¸ťčŚĺŠŸčƒ˝č‹ąć–‡çŽ€ç§°
release/ĺˆ†ć”Żĺ称
ćŻ”ĺŚ‚ďźŒćœŹćŹĄä¸Šçşżç‰Šć–™ĺş“ć–°ĺ˘žçš„ĺŠŸčƒ˝ďźŒĺˆ™ĺˆ†ć”Żĺ称ĺŻäťĽä¸şrelease/material-add
。
ĺŸşćœŹĺ‘˝äť¤čż™é‡Œĺ°ąä¸ĺ¤ščŻ´äş†ďźŒĺŸşćœŹčˇŸäťĽĺ‰ä¸€ć ˇďźŒĺ”Żä¸€çš„ĺŒşĺˆŤć˜Żćł¨ć„ĺˆ†ć”Żć˜ŻäťŽĺ“Şé‡Œć‹‰ĺŽťçš„äťĽĺŠĺˆ†ć”Żçš„ĺ‘˝ĺč§„čŒƒă€‚ćś‰ĺŠĺˆ°çš„命䝤丝čŚĺŒ…ĺŤäťĽä¸‹ďźŒĺ¤§ĺŽśč‡ŞĺˇąĺŚäš ďźš
ĺˆ†ć”Żć“ä˝œĺ‚č€ƒ Git常用ć“ä˝œ-ĺˆ†ć”ŻçŽĄç†
git flow
çŽ€ĺŒ–ć“ä˝œgit flow
ć˜Żgit的一个ć’äťśďźŒĺŻäťĽćžĺ¤§ç¨‹ĺşŚçš„çŽ€ĺŒ–ć‰§čĄŒgitć ‡ĺ‡†ĺˆ†ć”Żćľç¨‹çš„ć“ä˝œďźŒĺŻäťĽĺœ¨gitflow-avh厉装。
ĺŚ‚ćžœć˜Żwindowsä¸‹é€ščż‡ĺŽ‰čŁ…ĺŒ…ĺŽ‰čŁ…çš„gitďźŒĺˆ™čŻĽć’äťśéť˜čŽ¤ĺˇ˛çťĺŒ…ĺŤďźŒĺŻäťĽç›´ćŽĽä˝żç”¨ă€‚
使用git flow init
ĺˆĺ§‹ĺŒ–饚盎
$ git flow init Which branch should be used for bringing forth production releases? - develop - feature-fulltext - feature-vender - master Branch name for production releases: [master] Which branch should be used for integration of the "next release"? - develop - feature-fulltext - feature-vender Branch name for "next release" development: [develop] How to name your supporting branch prefixes? Feature branches? [feature/] Bugfix branches? [bugfix/] Release branches? [release/] Hotfix branches? [hotfix/] Support branches? [support/] Version tag prefix? [] Hooks and filters directory? [/Users/mylxsw/codes/work/e-business-3.0/.git/hooks]
git flow feature git flow feature start git flow feature finish git flow feature delete git flow feature publish git flow feature track
ĺŠŸčƒ˝ĺˆ†ć”Żä˝żç”¨äž‹ĺďźš
$ git flow feature start material-add Switched to a new branch 'feature/material-add' Summary of actions: - A new branch 'feature/material-add' was created, based on 'develop' - You are now on branch 'feature/material-add' Now, start committing on your feature. When done, use: git flow feature finish material-add $ git status On branch feature/material-add nothing to commit, working directory clean $ git flow feature publish Total 0 (delta 0), reused 0 (delta 0) To http://dev.oss.yunsom.cn:801/yunsom/e-business-3.0.git * [new branch] feature/material-add -> feature/material-add Branch feature/material-add set up to track remote branch feature/material-add from origin. Already on 'feature/material-add' Your branch is up-to-date with 'origin/feature/material-add'. Summary of actions: - The remote branch 'feature/material-add' was created or updated - The local branch 'feature/material-add' was configured to track the remote branch - You are now on branch 'feature/material-add' $ vim README.md $ git add --all $ git commit -m "modify readme file " [feature/material-add 7235bd4] modify readme file 1 file changed, 1 insertion(+), 2 deletions(-) $ git push Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 303 bytes | 0 bytes/s, done. Total 3 (delta 2), reused 0 (delta 0) To http://dev.oss.yunsom.cn:801/yunsom/e-business-3.0.git 0d4fb8f..7235bd4 feature/material-add -> feature/material-add $ git flow feature finish Switched to branch 'develop' Your branch is up-to-date with 'origin/develop'. Updating 0d4fb8f..7235bd4 Fast-forward README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) To http://dev.oss.yunsom.cn:801/yunsom/e-business-3.0.git - [deleted] feature/material-add Deleted branch feature/material-add (was 7235bd4). Summary of actions: - The feature branch 'feature/material-add' was merged into 'develop' - Feature branch 'feature/material-add' has been locally deleted; it has been remotely deleted from 'origin' - You are now on branch 'develop' $ git branch * develop feature-fulltext feature-vender master
git flow release git flow release start [] git flow release finish git flow release delete
git flow hotfix git flow hotfix start [] git flow hotfix finish git flow hotfix delete
ĺ‚č€ƒgit-flow ĺ¤‡ĺż˜ć¸…ĺ•
ĺŚ‚ćžœä¸Šé˘ĺ†…厚太多莰ä¸ä˝ďźŒäšŸć˛Ąćœ‰ĺ…łçłťďźŒä˝œä¸şĺź€ĺ‘äşşĺ‘˜ďźŒĺˆšĺź€ĺ§‹çš„ć—śĺ€™ĺŞčŚçŸĽé“äťĽä¸‹ĺ‡ ç‚šĺ°ąčśłĺ¤Ÿäş†ďźŒĺ…śĺŽƒçš„ĺŻäťĽĺœ¨ç˘°ĺˆ°çš„旜候ĺ†ćˇąĺ…ĽĺŚäš ďźš
develop
ĺˆ†ć”Żć‹‰ĺ–ć–°çš„ĺˆ†ć”Żčż›čĄŒĺź€ĺ‘ďźŒĺź€ĺ‘ĺŽŒćˆč‡Şćľ‹ć˛Ąćœ‰é—Žé˘˜ĺ†ĺˆĺšśĺˆ°develop
ĺˆ†ć”Żrelease
ĺˆ†ć”Żĺ‘ĺ¸ƒĺˆ°ćľ‹čŻ•çŽŻĺ˘ƒďźŒç”ąĺź€ĺ‘äşşĺ‘˜ĺˆ›ĺťşrelease
ĺˆ†ć”Żďźˆéœ€čŚćľ‹čŻ•äşşĺ‘˜ćĺ‡şéœ€ćą‚ďź‰ĺšśĺ‘ĺ¸ƒĺˆ°ćľ‹čŻ•çŽŻĺ˘ƒďźŒĺŚ‚ćžœćľ‹čŻ•čż‡ç¨‹ä¸ĺ‘现bugďźŒéœ€čŚĺź€ĺ‘äşşĺ‘˜track
ĺˆ°čŻĽreleaseĺˆ†ć”ŻäżŽĺ¤bugďźŒä¸Šçşżĺ‰éœ€čŚćľ‹čŻ•äşşĺ‘˜ć交merge request
ĺˆ°master
ĺˆ†ć”ŻďźŒĺ‡†ĺ¤‡ä¸ŠçşżďźŒĺŒć—śéœ€čŚĺˆĺšśĺ›ždevelop
ĺˆ†ć”Żă€‚master
上拉ĺ–hotfix
ĺˆ†ć”ŻďźŒhotfix
ĺˆ†ć”Żéœ€čŚćœ€çťˆĺŒć—śĺˆĺšśĺˆ°develop
ĺ’Œmaster
ĺˆ†ć”Żďźˆĺ…ąä¸¤ćŹĄmergeć“ä˝œďź‰master
ĺ’Œdevelop
ĺˆ†ć”ŻďźŒĺ…śĺŽƒĺˆ†ć”Żĺœ¨ĺź€ĺ‘ĺŽŒćˆĺŽéƒ˝čŚĺˆ é™¤ćœŹć–‡ĺ°†äźšćŒçťäżŽćŁĺ’Œć›´ć–°ďźŒćœ€ć–°ĺ†…厚诡ĺ‚č€ƒćˆ‘çš„ GITHUB 上的 程ĺşçŒżćˆé•żčŽĄĺˆ’ éĄšç›ŽďźŒćŹ˘čżŽ StarďźŒć›´ĺ¤šç˛žĺ˝Šĺ†…ĺŽščŻˇ follow me。
ç ”ĺ‘ĺ›˘é˜Ÿ GIT 埀ĺ‘ćľç¨‹ć–°äşşĺŚäš ćŒ‡ĺ—ďźŒéŚ–ĺ‘äşŽć–‡çŤ - 䟯äšĺœ¨çşżă€‚