[{"data":1,"prerenderedAt":19},["ShallowReactive",2],{"page:\u002Fresource-library\u002Fworking-with-git":3},{"path":4,"layout":5,"title":6,"description":7,"ogImage":8,"post":9,"html":18},"\u002Fresource-library\u002Fworking-with-git","post","Working with Git","A Git branching workflow beyond a single master branch: feature-driven development with feature branches that keep the main branch stable.","\u002Fimages\u002Fresource-library\u002Fmodular-repositories-with-git\u002Fgit-logo-render-social.jpg",{"author":10,"published":11,"updated":12,"tags":13,"image":17,"imageAlt":12},"Krithik Chandrashekar","2017-04-18",null,[14],{"name":15,"slug":16},"Embedded systems and software","embedded-software","\u002Fimages\u002Fresource-library\u002Fmodular-repositories-with-git\u002Fgit-logo-render.webp","\u003Ch2>Beginner’s dogma\u003C\u002Fh2>\n\u003Cp>When working with Git, the default workflow is to use one master branch for everything. The\n  integrity of local development keeps the master branch clean, which means it is assumed that\n  before a push is made to the master branch everything should be in working condition. Another\n  alternative that is commonly used is to make the master branch a work in progress that may or may\n  not be broken (during development) at each commit and have tags when the current HEAD of the\n  master is identified as significant enough for a “release”.\u003C\u002Fp>\n\u003Cp>There are some severe shortcomings in the above two approaches:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>Collaboration is nearly impossible. There’s no way to be explicitly aware of what feature or bug\n  fix an individual is working on. Also, working in parallel on two separate features is not\n  possible because every commit can be shuffled with other commits from one or more different\n  collaborators.\u003C\u002Fli>\n\u003Cli>No visibility of what features are being developed means no qualitative or quantitative measure\n  of the progress of the development.\u003C\u002Fli>\n\u003Cli>Integrity of the master branch is not guaranteed\u003C\u002Fli>\n\u003Cli>Rollback of features to a commit before a new feature is integrated is not easy unless the\n  release tags had well incremented improvements\u003C\u002Fli>\u003C\u002Ful>\n\u003Ch2>Feature-driven development\u003C\u002Fh2>\n\u003Cp>With this path, the master branch should always be clean and equipped to be “release-ready”.\n  Development progresses by assigning each significant addition to the code to its own branch and\n  then merging it to master.\u003C\u002Fp>\n\u003Cp>To begin with:\u003C\u002Fp>\n\u003Col>\n\u003Cli>Create a Git repo with the default branch as master, master is also protected\u003C\u002Fli>\n\u003Cli>Add a readme and commit to \u003Cstrong>master\u003C\u002Fstrong>\u003C\u002Fli>\n\u003Cli>Create a feature branch called \u003Cstrong>setup\u003C\u002Fstrong>\u003C\u002Fli>\n\u003Cli>Add the least possible code necessary to begin development for individual features, this would\n  include:\n\u003Cul>\n\u003Cli>Start with an internal template\u003C\u002Fli>\n\u003Cli>Tailor the template to a specific project\u003C\u002Fli>\n\u003Cli>Include any required libraries\u003C\u002Fli>\u003C\u002Ful>\u003C\u002Fli>\n\u003Cli>The \u003Cstrong>setup\u003C\u002Fstrong> branch can then be pushed to a remote origin which can then be\n  reviewed by a teammate\u003C\u002Fli>\n\u003Cli>The reviewer can then merge the code to master when it is deemed ready\u003C\u002Fli>\u003C\u002Fol>\n\u003Cp>\u003Cimg src=\"\u002Fimages\u002Fresource-library\u002Fworking-with-git\u002Fgit-logo-rendering.webp\"\n  alt=\"3D rendering of the Git logo, a branch and merge symbol on a black diamond\" width=\"385\"\n  height=\"502\" loading=\"lazy\" decoding=\"async\">\u003C\u002Fp>\n\u003Cp>For a more detailed reference, check out \u003Ca\n  href=\"https:\u002F\u002Fabout.gitlab.com\u002F2014\u002F09\u002F29\u002Fgitlab-flow\u002F\" target=\"_blank\" rel=\"noopener\">GitLab\n  Workflow\u003C\u002Fa> and \u003Ca href=\"https:\u002F\u002Fguides.github.com\u002Fintroduction\u002Fflow\u002F\" target=\"_blank\"\n  rel=\"noopener\">GitHub\u003C\u002Fa>\u003C\u002Fp>",1795194794406]