Git & Git Patterns. Trunk Devel, Git Flow & Feature Flags. Merge BOTs
Git and Patterns for Managing Source Code Branches. Merge BOTs¶
- Git Distributed Version-Control System
- Design By Contract
- Git Cheat Sheets
- Patterns for Managing Source Code Branches (Branching Models/Workflows)
- Git Commands
- BitBucket
- GitLab
- GitHub
- Git Tools
- Azure DevOps (formerly known as VSTS)
- Merge BOTs
Git Distributed Version-Control System¶
- Wikipedia: Git
- Git
- devdocs.io/git/
- tutorialzine.com: Learn git in 30 minutes π
- 3 Git Commands I Use Every Day
- Git and Github in Plain English
- opensource.com: How to restore older file versions in Git
- 9 awesome git tricks
- Awesome Git π
- dzone.com: intro git π
- dzone.com: Top 20 git commands with examples π
- dzone.com: 8 Useful But Not Well-Known Git Concepts These lesser-known Git tricks can help you solve problems that are not handled well by the GitHub and BitBucket GUIs
- dzone.com: Git Commands Tutorial - Part 1
- dzone.com: Git Commands Tutorial - Part 2
- Dzone refcard: Getting started with Git
- Oh shit, git!
- How to Get More Out of Your Git Commit Message
- 10 useful Git commands you wish existed β and their alternatives
- github.blog: How to undo (almost) anything with Git
- dev.to: Git Explained - The Basics
Design By Contract¶
Wikipedia: Design by contract (DbC), also known as contract programming, programming by contract and design-by-contract programming, is an approach for designing software.
It prescribes that software designers should define formal, precise and verifiable interface specifications for software components, which extend the ordinary definition of abstract data types with preconditions, postconditions and invariants. These specifications are referred to as “contracts”, in accordance with a conceptual metaphor with the conditions and obligations of business contracts.
Git Cheat Sheets¶
Patterns for Managing Source Code Branches (Branching Models/Workflows)¶
- paulhammant.com: What is Your Branching Model?: Mainline, Cascade, Trunk-Based Development, Short Lived Feature Branches, Continuous Deployment, Subversion noise on branching, etc.
- adevait.com: Creating a Branching Strategy for Small Teams
- atlassian.com: Configuring branching models π
- git-scm.com: Git Branching - Branching Workflows
- git-scm.com: Distributed Git - Distributed Workflows
- Dzone refcard: Git Patterns and Anti-Patterns Scaling from Workgroup to Enterprise. Suggests patterns and anti-patterns, including Hybrid SCM, Git champions, blessed repository, per-feature topic branches, and ALM integration.
- Dzone: Basic Git Branching In this article, we walk through the basics of branching with Git to get you started with better managing your versioning during projects.
- martinfowler.com: Patterns for Managing Source Code Branches
- Release Branch Pattern: A branch that only accepts commits accepted to stabilize a version of the product ready for release.
- medium: Which Git branching model should I select for my project?
Git Workflows¶
git help workflows
- atlassian.com: Comparing Workflows π
- GitLab Flow
- GitHub Flow
- Git Flow
- Git DMZ Flow
Trunk Based Development¶
- Trunk Based Development
- paulhammant.com: What is Trunk-Based Development?
- The Origins of Trunk Based Development
- quora.com: What is trunk based development?
- kean.github.io: Trunk-Based Development
- paulhammant.com: Microsoft’s Trunk-Based Development
- devblogs.microsoft.com: Release Flow: How We Do Branching on the VSTS Team
Feature Branch Development (aka GitFlow)¶
Git Flow¶
- One of the main concepts of GitFlow is feature branches. The idea is that each feature should be developed in its own branch. When the feature is done, it gets merged into develop branch.
- devopszone.info: An Introduction To Git-flow Workflow
- atlassian.com: Gitflow Workflow
- gitkraken.com: GitFlow is a list of rules to keep a repoβs history organized, and is used to make the release process, bug fixes, and feature creation easier.
- git-flow.readthedocs.io
- medium.com: Gitflow β Branch Guide
- medium.com: Git Flow for Beginners
- medium.com: What is GitFlow?
- gist.github.com/JamesMGreene: A comparison of using
git flow
commands versus rawgit
commands - Git-flow cheatsheet
- aprendegit.com: git-flow: la rama develop y uso de feature branches
Trunk-based Development vs. Git Flow¶
- toptal.com: Trunk-based Development vs. Git Flow
- victorops.com: Source Code Control: Trunk-Based Development vs. GitFlow
- medium: GitFlow VS Trunk-Based-Development
- Dzone: Why I Prefer Trunk-Based Development Over Feature Branching and GitFlow π Check out the components of Trunk-based Development as implemented by Facebook and Google, and see how it helps resolve and prevent merge conflicts.
- team-coder.com: From Git Flow to Trunk Based Development
- stridenyc.com/podcasts: Trunk Based Development vs Gitflow
Alternative Branching Models¶
Feature Flags (Feature Toggles)¶
- featureflags.io: Flags vs Branching Branch better with feature flag driven development.
- martinfowler.com: Feature Toggles (aka Feature Flags)
- #FeatureFlags
- CloudBees Releases Another Industry First: Feature Flagging for On-Premise Use π
Git Commands¶
- Show commit logs:
git log --oneline --all --graph --decorate
git reset --hard HEAD^
git push origin -f
BitBucket¶
- bitbucket.org
- Atlassian Git Cheatsheet
- Dzone: source control using atlassian bitbucket
- Dzone: how I use bitbucket in my regular routine
GitLab¶
GitHub¶
- GitHub Codespaces Get the full Visual Studio Code experience without leaving GitHub.
- GitHub CLI
Git Tools¶
Azure DevOps (formerly known as VSTS)¶
- Wikipedia: Azure DevOps
- wikipedia: Azure DevOps Server Collaboration software for software development formerly known as Team Foundation Server and Visual Studio Team System
- wikipedia: Azure DevOps Services Cloud service for software development formerly known as Visual Studio Team Services, Visual Studio Online and Team Foundation Service Preview
- Azure DevOps Labs π
- twitter.com/azuredevops
- Microsoft Visual Studio Team Services (VSTS)
- Microsoft Visual Studio Team Services (VSTS) Tutorial: The Cloud ALM Platform
- slideshare.net: Git version control and trunk based approach with VSTS
- Microsoft Replacing Visual Studio Team Services with Azure DevOps
- How We Use Git at Microsoft
Merge BOTs¶
- The Merge Bot is a tool to orchestrate pull requests merging into the stable branches.
- Wikipedia: Software bot
Tips¶
- Use bots to accomplish tasks like merging PR’s that have been approved and automatically updating dependencies. Usage of one of these bots might allow us to trigger certain builds based off of specific GitHub tags, it would allow us to only selectively run certain test suites and increase the throughput of the build by only testing changes made in a branch / PR.
- Investigate options that are available and see if we can integrate them with CI.
- We should be able to configure this bot to automatically apply labels to PR’s based off of what is changed in a PR. For instance, if a PR contains any documentation changes, the area/Documentation label can be applied.
Jenkins for git merges¶
- Git Plugin: Merge Extensions
- Validated Merge Plugin for Git in CloudBees Jenkins Enterprise π
- How to configure Jenkins for git merge
- GitHub Pull Request Builder Plugin , github ref. You should probably migrate to GitHub Branch Source Plugin.
- GitHub Branch Source Plugin: Allows you to create a new project based on the repository structure from one or more GitHub users or organizations.
Bitbucket for git merges¶
- Automatic branch merging
- BitBucket Auto Merge Automatically create and merge pull request to keep branches in sync.
- Checks for merging pull requests
- BitBucket Bot for Microsoft Teams
- Code Dog Merge your Pull Requests sooner. Some of the Slack messages your team sends are critical for productivity. Automate them.
- Jenkins Plugin: Bitbucket Push and Pull Request
- How to Implement the Automerge feature that is missing from BitBucket cloud
- Configure bitbucket-pipelines.yml to automatically merge feature branch to master?
GitLab for git merges¶
- Auto-merge between release branches
- Provide merge bot functionality
- lab.texthtml.net: Gitlab Merge Bot
- DockerHub: Gitlab Merge Bot Bot assistant for code review and merge requests approval for Gitlab
- Mergecrush A email & slack reminder bot for Gitlab merge requests.
- stackoverflow.com: How can we programmatically approve merge requests in GitLab?
- Our group has a bot that creates merge requests for certain mechanical changes to our code base. We’d like these MRs to get merged in automatically if/when the CI pipeline succeeds, but our projects require an approval from a member of our group. This means that right now a human has to manually click on “approve” and “merge” for each bot-created MR. Apparently GitLab doesn’t have a way to set different approval rules for some users, so I haven’t found a way to make the bot’s user immune to this requirement.
- My current idea is to have a separate process that approves each of the merge requests created by the bot. Is there an easy way to do this programmatically? That is, is there an API (or better yet, a command line tool) that, when given the name of the branch for a merge request, approves the merge request associated with that branch?
- I’m also open to other ways of getting these changes in with minimal human intervention. I do want them to pass the CI pipeline, though (which is currently accomplished by having them use MRs) and the MRs also help in the rare cases where the pipeline fails, so we can debug what went wrong.
Marge GitLab bot¶
- Marge-bot: A merge-bot for GitLab
- Example: gitlab.gnome.org/marge-merge-bot
- Example: Smarkets’s Marge-bot for GitLab keeps master always green
- Example: GStreamer Merge Bot
Jenkins-X bots¶
- Jenkins-X UpdateBOT A simple bot for updating dependencies in source code and automatically generating Pull Requests in downstream projects.
Plastic SCM bot¶
- Plastic SCM
- blog.plasticscm.com: Add a mergebot to your repo!
- Plastic SCM DevOps Mergebot to implement a trunk-based development cycle
- PlasticSCM MergeBot Jenkins Plugin
- genbeta.com: Plastic SCM Mergebot: automatizando tu pipeline de desarrollo
Mergify bot¶
GitHub bots¶
- github-rebase-bot A github bot that monitors repository PRs, rebases them and merges them as they pass tests.
- Bulldozer: GitHub Pull Request Auto-Merge Bot
- github-merge-bot Automates the process of merging pull requests and keeping them up-to-date.
- github.com/squalrus/merge-bot: PR Merge Bot A GitHub action that manages pull request integrations
- Odoo Mergebot
- gmaster.io - Mergedroid: Automate merging just by analyzing your GitHub repo. A BOT that solves conflicts in pull requests without manual intervention.
- Kodiak GitHub bot for updating and merging pull requests
- Rultor A merging bot for Github pull requests
- stackoverflow.com: Bot to automatically reverse GitHub pull request merges. Maybe it’s best to not allow the merges instead of reverting them:
- help.github.com: Configuring protected branches
- help.github.com: Enabling required status checks:
- Select Require status checks to pass before merging
- Choose (create) a status check, that always fails