How do you maintain development code and production code? [closed] Ask Question

How do you maintain development code and production code? [closed] Ask Question

What are the best practices and rules-of-thumb to follow while maintaining code? Is it good practice to have only the production ready code in the development branch, or should untested latest code be available in the development branch?

How do you guys maintain your development code and production code?

Edit - Supplementary question - Does your development team follow "commit-as-soon-as-possible-and-often-even-if-the-code-contains-minor-bugs-or-is-incomplete" protocol or "commit-ONLY-perfect-code" protocol while committing code to DEVELOPMENT branch?

ベストアンサー1

Update 2019:

These days, the question would be seen in a context using Git, and 10 years of using that distributed development workflow (collaborating mainly through GitHub) shows the general best practices:

  • masterブランチは、いつでも本番環境にデプロイできる状態です。つまり、選択された機能ブランチのセットが にマージされた次のリリースですmaster
  • dev(または統合ブランチ、または ' next')は、次のリリース用に選択された機能ブランチが一緒にテストされるブランチです。
  • maintenance(またはhot-fix)ブランチは、現在のリリースの進化/バグ修正のためのものです。devおよびまたはへのマージが可能master

この種のワークフロー(devにマージするのではなくmaster、機能ブランチのみを にマージしdev、選択した場合は にマージして、master次のリリースの準備ができていない機能ブランチを簡単に削除できるようにする)は、Gitリポジトリ自体に実装されており、gitワークフロー(一言、ここに図示)。
詳しくはrocketraman/gitworkflowトランクベース開発と比較してこれを行った経緯は、以下のコメントや議論で述べられています。この記事はアダム・ディミトラックによるものです

https://github.com/rocketraman/gitworkflow/raw/master/docs/images/topicgraduation.png

(ソース:Gitworkflow: タスク指向の入門

注: この分散ワークフローでは、いつでもコミットして、問題なく WIP (進行中の作業) を個人用ブランチにプッシュできます。コミットを機能ブランチの一部にする前に、コミットを再編成 (git rebase) できます。


元の回答 (2008 年 10 月、10 年以上前)

それはすべてリリース管理の連続性

まず、トランクにすべて入っていますか次のリリースに向けて現在開発されている機能の一部は以下のとおりです。

  • 複雑すぎるので、まだ改良が必要です
  • 間に合わない
  • 興味深いが、次のリリースではそうではない

この場合、トランクには現在の開発作業がすべて含まれている必要がありますが、次のリリースの前に早期に定義されたリリースブランチは、統合ブランチ適切なコード(次のリリース用に検証済み)のみがマージされ、認証フェーズで修正され、最終的に本番環境に移行するときに固定されます。

本番環境のコードに関しては、パッチブランチただし、次の点に留意してください。

  • 最初のパッチ セットは、実際には最初に本番環境にリリースされる前に開始される可能性があります (つまり、時間内に修正できないバグがいくつかある状態で本番環境にリリースされることがわかっていますが、別のブランチでそれらのバグに対する作業を開始できます)。
  • 他のパッチブランチは、明確に定義されたプロダクションラベルから開始できるという贅沢さを持つ。

開発ブランチに関しては、他に開発作業を行う必要がない限り、トランクを1つ持つことができます。並行してのように:

  • 大規模なリファクタリング
  • 他のクラスで呼び出す方法を変える可能性のある新しい技術ライブラリのテスト
  • 重要なアーキテクチャの変更を組み込む必要がある新しいリリース サイクルの開始。

Now, if your development-release cycle is very sequential, you can just go as the other answers suggest: one trunk and several release branches. That works for small projects where all the development is sure to go into the next release, and can just be frozen and serve as a starting point for release branch, where patches can take place. That is the nominal process, but as soon as you have a more complex project... it is not enough anymore.


To answer Ville M.'s comment:

  • keep in mind that dev branch does not mean 'one branch per developer' (which would trigger 'merge madness', in that each developer would have to merge the work of other to see/get their work), but one dev branch per development effort.
  • When those efforts need to be merged back into trunk (or any other "main" or release branch you define), this is the work of the developer, not - I repeat, NOT - the SC Manager (who would not know how to solve any conflicting merge). The project leader may supervise the merge, meaning make sure it starts/finish on time.
  • whoever you choose for actually doing the merge, the most important is:
    • to have unit tests and/or assembly environment in which you can deploy/test the result of the merge.
    • to have defined a tag before the beginning of the merge in order to be able to get back to previous state if said merge proves itself too complex or rather long to resolve.

おすすめ記事