Files
awesome-kubernetes/docs/git.md
Inaki Fernandez 447bacdc3d Sept 23rd
2021-09-23 11:42:44 +02:00

56 KiB
Raw Blame History

Git and Patterns for Managing Source Code Branches. Merge BOTs

Git Distributed Version-Control System

Git Submodules

  • git-scm.com: Git Tools - Submodules It often happens that while working on one project, you need to use another project from within it. Perhaps its a library that a third party developed or that youre developing separately and using in multiple parent projects. A common issue arises in these scenarios: you want to be able to treat the two projects as separate yet still be able to use one from within the other.

Git Interview Questions

Shields

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

Monorepo VS Polyrepo

Patterns for Managing Source Code Branches (Branching Models/Workflows)

<script async class="speakerdeck-embed" data-id="1eaed7dabacb4f9b9c96b08de38eb9e1" data-ratio="1.77777777777778" src="//speakerdeck.com/assets/embed.js"></script>

Git Workflows

Trunk Based Development

Feature Branch Development (aka GitFlow)

Git Flow

Trunk-based Development vs. Git Flow

Alternative Branching Models

Feature Flags (Feature Toggles)

Keystone Interface and Keystone Flags

Git Commands

  • Show commit logs:
git log --oneline --all --graph --decorate
git reset --hard HEAD^
git push origin -f

BitBucket

GitLab

GitLab Collective

GitHub

GitHub Actions

GitHub Actions Marketplace

  • flat-data Flat Data is a GitHub action which makes it easy to fetch data and commit it to your repository as flatfiles. The action is intended to be run on a schedule, retrieving data from any supported target and creating a commit if there is any change to the fetched data.

GitHub Actions and OpenShift

GitHub Copilot

Gitea

Git Tools

Semantic-release. CI/CD semantic release workflow (semantic Versioning, commit format and releases)

Azure DevOps (formerly known as VSTS)

Pre Commit Hooks

Merge BOTs

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

Bitbucket for git merges

GitLab for git merges

  • Auto-merge between release branches
  • Provide merge bot functionality
  • lab.texthtml.net: Gitlab Merge Bot
  • 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

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

Mergify bot

GitHub bots

Bors GitHub bot


Tweets

Click to expand!

No, ninguna inteligencia artificial te va a quitar tu trabajo como data scientist o developer.

La automatización de @github CoPilot creará más trabajos de los que destruirá.

Acá te explico porque 👇🧵

— Xavier Carrera (@XaviGrowth) June 30, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

I'm using GitHub Copilot in the last few hours and all I'm going to say that it is magic. It really helps me with dealing with the boilerplate, writing code comments, and avoiding antipatterns. It also is occasionally reading my mind.

— Jaana Dogan ヤナ ドガン (@rakyll) July 8, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

GitHub's Copilot would benefit from a compliance feature to help developers detect when any code, hand written or auto generated, possibly violates another projects license or copyright.

— Kelsey Hightower (@kelseyhightower) July 8, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Today's @code tip: the git stash commands

Create, apply, and manage #git stashes using VS Code commands.

Stashes let you quickly save off your workspace changes and restore them when they are needed again#code2020 pic.twitter.com/VPursGdRka

— Matt Bierner (@mattbierner) June 27, 2020
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Writing good Git commit messages matters!

A thread about how to write clean commit messages:

🧵 👇

— Deni Moka (@dmokafa) January 18, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Here are _some_ of the most essential git operations you will need when working as a developer.

🧵🔽 pic.twitter.com/ZTUUObuj70

— Oliver Jumpertz (@oliverjumpertz) March 23, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Git is by far the most used source control management tool out there.

It is basially an essential to know. And this justifies knowing a few of the most important git commands you need in your daily work.

Here are 19 that any developer should know.

A thread. ↓ pic.twitter.com/nLglrUWp6o

— Oliver Jumpertz (@oliverjumpertz) August 11, 2021
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>