<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Sergio Ocón-Cárdenas</title>
    <description>The latest articles on Forem by Sergio Ocón-Cárdenas (@chargio).</description>
    <link>https://forem.com/chargio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F911628%2F69a31113-8d8f-4f50-a99f-73e7228c5650.jpeg</url>
      <title>Forem: Sergio Ocón-Cárdenas</title>
      <link>https://forem.com/chargio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/chargio"/>
    <language>en</language>
    <item>
      <title>Kubernetes cluster management with Monokle</title>
      <dc:creator>Sergio Ocón-Cárdenas</dc:creator>
      <pubDate>Thu, 19 Jan 2023 18:18:27 +0000</pubDate>
      <link>https://forem.com/kubeshop/kubernetes-cluster-management-with-monokle-27p5</link>
      <guid>https://forem.com/kubeshop/kubernetes-cluster-management-with-monokle-27p5</guid>
      <description>&lt;h2&gt;
  
  
  If you like OpenLens you will love the new cluster mode in Monokle Desktop
&lt;/h2&gt;

&lt;p&gt;Monokle is a suite of tools designed to help developers and platform engineers manage the application configuration lifecycle in Kubernetes. It includes an open-source &lt;a href="https://monokle.io/download" rel="noopener noreferrer"&gt;Desktop application&lt;/a&gt; for Windows, Linux, and Mac, a  &lt;a href="https://app.monokle.com/" rel="noopener noreferrer"&gt;cloud service&lt;/a&gt; integrated with GitHub, and an &lt;a href="https://monokle.io/blog/monokle-cli-flexible-kubernetes-yaml-validation" rel="noopener noreferrer"&gt;open-source&lt;/a&gt; command-line interface that can be used to validate Kubernetes configurations as part of existing workflows.&lt;/p&gt;

&lt;p&gt;When we started working on Monokle in August 2021, our idea was to create the best configuration management system possible for Kubernetes, and we have been adding features for developers and Platform Engineers since then. We have been steadily releasing new versions every few weeks, and up to the current release we have added support for Helm and Kustomize, templates, opa policy visualization in real time, and lately cluster inspection capabilities. We saw ourselves as a complement to other tools, helping with the configuration, while they could focus on the cluster management itself. However, some recent changes in the Lens license and the OpenLens project made their users look for a viable alternative and when they discovered Monokle Desktop, they asked for improvements to what we already had.&lt;/p&gt;

&lt;p&gt;We have heard that, and for that reason &lt;a href="https://monokle.io/blog/monokle-1-13-release" rel="noopener noreferrer"&gt;Monokle 1.13&lt;/a&gt; introduced a new real time cluster mode that allows you to quickly get an overview of the resources and applications running in your clusters, reducing the cognitive load involved in deploying and maintaining your application in Kubernetes and providing full end to end configuration lifecycle management for your application.&lt;/p&gt;

&lt;p&gt;So we are introducing new features that will allow Monokle Desktop to connect to your cluster and show the information required to manage your application, at a basic level, in addition to all the validations, templating and configuration that we already support. And we are using your existing kubectl configuration, so you can start using it as soon as you download it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff7nktqmdczbo9fqptfgz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff7nktqmdczbo9fqptfgz.png" alt="New cluster mode dashboard" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Cluster Dashboard with real time updates
&lt;/h2&gt;

&lt;p&gt;Until now, you could use Monokle to get  a snapshot of the list of  resources in your clusters, allowing you to use that as the source for validation and compare to local configuration. Changes in the cluster were not reflected until you hit the refresh button and the management was quite limited. Monokle 1.13 now shows any updates happening to your resources in real-time - making sure you are always viewing the resources as they are actually deployed in your cluster. In addition to real time updates, Monokle has added summary and detailed information for your clusters and their resources, making it easy to assess if your application is behaving correctly or if your cluster has enough free resources to work correctly.&lt;/p&gt;

&lt;p&gt;This new dashboard also gives you a direct view of the CPU, memory and Storage in use by the cluster and projects, including information about the Kubernetes version used by your cluster, the container runtime and the alerts generated in your cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logs and Terminal
&lt;/h2&gt;

&lt;p&gt;Do you really need to understand how your application is working in your cluster? Is the pod behaving properly but the application is not behaving as expected. You can access the log directly in the tab available for your pods in the navigator.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcaf8039tatzwtpj8gppe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcaf8039tatzwtpj8gppe.png" alt="Accessing logs from a pod" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And you have a dedicated link to the terminal, so you can access it directly from the application, without needing you to go to another place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources and CRDs
&lt;/h2&gt;

&lt;p&gt;Monokle Desktop 1.13 shows you a list of all resource types and the associated resources installed in your cluster, so you can quickly review what is installed in your cluster. If your cluster has been extended using a CRD, Monokle will understand and group resources as instances of the new “Kind”, so you can quickly identify which of them are active. &lt;/p&gt;

&lt;p&gt;Have you installed CertManager or Istio and you want to make sure that the DestinationRule is working? Just select the DestinationRule section of the Navigator and visualize all your installed manifests&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9egp7kadgvm8djuohhg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9egp7kadgvm8djuohhg6.png" alt="Resource types list after adding a CRD" width="408" height="784"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do you need the IP addresses of your services, or the ports that are opened? Just select services in the Navigator and the list will include those details that are important for your development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flc2277rr8bjst53cooil.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flc2277rr8bjst53cooil.png" alt="Ports and IP of services in the cluster" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Monitoring Cluster Activity
&lt;/h2&gt;

&lt;p&gt;How is your cluster behaving? Is there something you need to know about your cluster that can affect the way your application runs?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmoqh3a9ob2crsxgd4rci.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmoqh3a9ob2crsxgd4rci.png" alt="List of events in the cluster" width="800" height="573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have added an activity panel to the cluster dashboard in Monokle 1.13, so you can see if some event requires your attention. Right now it is read only but we plan to add additional interactions soon after this release.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automatic Resource Validation
&lt;/h2&gt;

&lt;p&gt;Monokle constantly validates your configuration against your Kubernetes schema, links, and different kinds of policies, so it is easy for you to identify if there is something wrong with your configuration or if your cluster policy prevents it from running.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3v1q8avxwfgpuddov7y6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3v1q8avxwfgpuddov7y6.png" alt="Real time validation for every resource in the cluster" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even if your manifest is already deployed, you can check the resources inside the cluster to make sure that the configuration is compliant to policies, or whether it will be valid in the next update of your cluster. For example, you can use it to be sure that you didn’t deploy a ReplicaSet that was unintentionally using the “latest” label against your best practices, or review that the APIs used in your cluster will still be valid when you upgrade your cluster to the next major version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Details and state of Deployments / Pods
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9pl0wn3lhk064h9z6y6j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9pl0wn3lhk064h9z6y6j.png" alt="State of pods" width="800" height="176"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Monokle can now show you details of many of the resources installed on your cluster, including deployments and pods, with their reported state. You can also see incoming and outgoing links to your resources, so you can easily navigate through the components of your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resource Comparison
&lt;/h2&gt;

&lt;p&gt;One of the many utilities included in Monokle is the ability to compare configurations. It doesn’t matter if you want to compare overlays of your Kustomize deployment, the configuration stored in different git branches or commits, or any of the with the actual configuration deployed in your cluster&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx6hghqkkx8k8244bchkn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx6hghqkkx8k8244bchkn.png" alt="Compare configurations" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not only that, but you can use Monokle to make local copies of the configuration deployed in your cluster, update them and push it back to your cluster directly or storing the configuration in git, or generating a pull request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffy48gvu8jie33bvuegcs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffy48gvu8jie33bvuegcs.png" alt="Synchronize cluster and local config" width="800" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s next?
&lt;/h2&gt;

&lt;p&gt;Cluster mode in Monokle is new and we have a lot of features in our roadmap that will make it better. Our next version, 2.0, will heavily improve the performance, along with a new interface that we think is better suited for interaction with configurations and clusters. Some of the things that you will be able to see in 2.0 and beyond will be:&lt;br&gt;
Performance improvements for cluster with 1000+ resources&lt;br&gt;
New resource focused UX, that will greatly improve the experience&lt;br&gt;
Graph view to quickly  understand the relationship between elements and layers&lt;br&gt;
Additional improvements to the validations supported&lt;/p&gt;

&lt;p&gt;And we plan to add new features in upcoming weeks like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easily identify the parts of the YAML that are not editable, to avoid introducing changes that will not be deployable in your cluster.&lt;/li&gt;
&lt;li&gt;Better cluster information, including resource timelines when Prometheus is installed.&lt;/li&gt;
&lt;li&gt;Identify parent/child relationships using ownerRefs to provide additional insight for resources that are managed by the same owner.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Next steps
&lt;/h2&gt;

&lt;p&gt;We would love to have your input on all these things. We are actively talking to users to discuss use cases and problems that we can help to fix, and we are also establishing partnerships to make Monokle way more useful for your day to day work. You can contact &lt;a href="https://calendly.com/sergio-ocon" rel="noopener noreferrer"&gt;us&lt;/a&gt; for a 30’ conversation or join our &lt;a href="https://discord.gg/uNuhy6GDyn" rel="noopener noreferrer"&gt;Discord channel&lt;/a&gt;, or you can directly open a new issue in &lt;a href="https://github.com/kubeshop/monokle/issues" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; to let us know what you think.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Monokle Ecosystem
&lt;/h2&gt;

&lt;p&gt;Monokle is an integrated set of tools for creating and maintaining high-quality Kubernetes configurations throughout the entire lifecycle of your applications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Monokle Desktop&lt;/strong&gt; is a unified visual tool for authoring, analysis and deployment of Kubernetes configurations, covering the entire configurations lifecycle, from creation to validation to deployment. 100% free and open source. [&lt;a href="https://monokle.io/" rel="noopener noreferrer"&gt;Kubernetes YAML manifests made easy | Monokle&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monokle Cloud&lt;/strong&gt; is a free browser-based tool to explore, validate and manage your Kubernetes configurations and GitOps repositories on GitHub. [&lt;a href="https://monokle.io/download" rel="noopener noreferrer"&gt;Download Monokle Desktop&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monokle CLI&lt;/strong&gt; is a flexible and easy to use command-line tool for validating Kubernetes configurations as part of your existing pre-deployment workflows. 100% free and open source. [&lt;a href="https://app.monokle.com/" rel="noopener noreferrer"&gt;Monokle&lt;/a&gt;]&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>opensource</category>
      <category>softwareengineering</category>
      <category>devops</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Announcing Monokle 1.13, now with cluster management</title>
      <dc:creator>Sergio Ocón-Cárdenas</dc:creator>
      <pubDate>Tue, 13 Dec 2022 16:28:59 +0000</pubDate>
      <link>https://forem.com/kubeshop/announcing-monokle-113-now-with-cluster-management-5ggk</link>
      <guid>https://forem.com/kubeshop/announcing-monokle-113-now-with-cluster-management-5ggk</guid>
      <description>&lt;p&gt;It’s a pleasure to share the latest release of our open source project,  &lt;em&gt;&lt;a href="http://www.monokle.io" rel="noopener noreferrer"&gt;Monokle Desktop&lt;/a&gt;&lt;/em&gt; - a unified visual tool for authoring, analyzing, and deploying Kubernetes configurations, from pre-deployment to cluster.&lt;/p&gt;

&lt;p&gt;The most exciting features of our v1.13 release include Cluster Mode for easy cluster management and an addition to our Compare &amp;amp; Sync feature that eliminates the stress of working on projects containing lots of subfolders.&lt;/p&gt;

&lt;p&gt;Cluster Mode offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Real-time visibility of resources actively deployed in-cluster&lt;/li&gt;
&lt;li&gt;Clear vision of cluster updates &lt;/li&gt;
&lt;li&gt;In-cluster resource validation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read about all new features in the&lt;a href="https://monokle.io/blog/monokle-1-13-release" rel="noopener noreferrer"&gt; announcement blog-post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Monokle Desktop can be &lt;a href="https://monokle.io/download" rel="noopener noreferrer"&gt;downloaded&lt;/a&gt; and used on Windows, Mac OS X, and Linux. &lt;/p&gt;

&lt;p&gt;Feedback is of course appreciated - either here or on our &lt;a href="https://discord.com/invite/6zupCZFQbe" rel="noopener noreferrer"&gt;Discord server&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>deployment</category>
      <category>yaml</category>
      <category>kustomize</category>
    </item>
    <item>
      <title>Monokle, Kustomize &amp; Quality Kubernetes Deployments</title>
      <dc:creator>Sergio Ocón-Cárdenas</dc:creator>
      <pubDate>Thu, 24 Nov 2022 18:41:30 +0000</pubDate>
      <link>https://forem.com/kubeshop/monokle-kustomize-quality-kubernetes-deployments-3pi8</link>
      <guid>https://forem.com/kubeshop/monokle-kustomize-quality-kubernetes-deployments-3pi8</guid>
      <description>&lt;h2&gt;
  
  
  &lt;a href="https://kubeshop.io/blog/monokle-kustomize-quality-kubernetes-deployments" rel="noopener noreferrer"&gt;Monokle, Kustomize &amp;amp; Quality Kubernetes Deployments — Kubeshop&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;From the beginning, Kubernetes development has been complex. And as developers learned new tricks, split one manifest into many, tacked on configuration management or templating, and launched dozens or hundreds of new pods with a single run of &lt;code&gt;kubectl&lt;/code&gt;, Kubernetes development got *really *complex.&lt;/p&gt;

&lt;p&gt;In time, it was too much for a single person to understand, maintain, and optimize every resource and relationship required to deploy an application, whether between two locally-stored manifest files or two pods in a production cluster. New versions of existing Kubernetes API, like networking, were created and allowed new use cases, in many cases at the expense of additional complexity.&lt;/p&gt;

&lt;p&gt;As a stopgap solution to this ballooning complexity, developers started “forking” manifests from vendors, using them as templates. Instead of writing a manifest for a reverse Nginx proxy again and again, why not download a manifest directly from the Nginx developers, add a few tweaks, and shortcut your time to deployment?&lt;/p&gt;

&lt;p&gt;This model addressed one fundamental problem: that of deploying an application and the additional configuration elements required for it to work. Unfortunately, it didn’t take into account the full lifecycle of the application. When the vendor released a new version of their manifest (the configuration file) with added features or bug fixes, they had to re-fork and re-apply their customizations. This meticulous and manual workflow to stay synchronized with vendor releases was rigid and created &lt;em&gt;more&lt;/em&gt; risk, slowing development.&lt;/p&gt;

&lt;p&gt;There are many solutions in the Kubernetes space to address this problem, but one of them is built into kubectl: Kustomize—native configuration management designed for simplifying YAML &lt;em&gt;without&lt;/em&gt; templates or forking.&lt;/p&gt;

&lt;h2&gt;
  
  
  How developers use Kustomize
&lt;/h2&gt;

&lt;p&gt;Kustomize is an &lt;a href="https://github.com/kubernetes-sigs/kustomize" rel="noopener noreferrer"&gt;open-source project&lt;/a&gt; that “lets you customize raw, template-free YAML files for multiple purposes, leaving the original YAML untouched and usable as is.” It’s now the most popular tool for customizing Kubernetes manifests reasonably, and it’s even &lt;a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/#bases-and-overlays" rel="noopener noreferrer"&gt;built directly into the Kubernetes CLI since K8s v1.14&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Kustomize lets developers preserve the base settings of their applications, Kubernetes resources, or components, and then apply “patches” that override said defaults. It allows you to add, remove and update configuration options, something that is useful in a whole variety of situations, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Defining environmental variables, like LOG_LEVEL, to help you debug issues&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploy different versions of the database for development and production&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using Kubernetes secrets without committing them to Git by using a generator&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adding the same labels, namespaces and annotations to all Kubernetes resources&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Editing the number of replicas created by a Kubernetes deployment, or the appropriate CPU and memory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make all of the above dependent on the environment where you are deploying the application (Development, QA, Testing, Production)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7ru5j9kbeplx8fjy6z6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7ru5j9kbeplx8fjy6z6.png" alt="Using a helm template as a base for Kustomize" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately, you will still need to create and use YAML files. Kubernetes simply won’t allow you to get rid of them because it uses manifests as the base that gets updated through customizations. So, Kustomize rescues us by allowing us to select an existing YAML manifest to customize before applying it in the server.&lt;/p&gt;

&lt;p&gt;Let’s say that your application requires three configuration files (manifests) — a ConfigMap, a Deployment, and a Service — which are your “base” files, as Kustomize defines them. Your working directory would look like this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your-app/
├── configmap.yaml
├── deployment.yaml
└── service.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The easiest way to use Kustomize is to modify all files by adding a label kustomization.yaml file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your-app/
├── configmap.yaml
├── deployment.yaml
├── service.yaml
└── kustomization.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Once you have added Kustomization to the mix, create a single kustomization.yaml file into your working directory, and refer it to the previous files:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;table&amp;gt;
  &amp;lt;tr&amp;gt;
   &amp;lt;td&amp;gt;&amp;lt;code&amp;gt;commonLabels:&amp;lt;/code&amp;gt;
&amp;lt;p&amp;gt;
&amp;lt;code&amp;gt;  app: hello&amp;lt;/code&amp;gt;
&amp;lt;p&amp;gt;
&amp;lt;code&amp;gt;resources: \
- configmap.yaml \
- deployment.yaml&amp;lt;/code&amp;gt;
&amp;lt;p&amp;gt;
&amp;lt;code&amp;gt;- service.yaml&amp;lt;/code&amp;gt;
   &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
  &amp;lt;tr&amp;gt;
   &amp;lt;td&amp;gt;
   &amp;lt;/td&amp;gt;
  &amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For more complex customizations, like those dependent on the deployment environment, Kustomize supports the concept of &lt;em&gt;overlay&lt;/em&gt; and a &lt;em&gt;base&lt;/em&gt;. The base declares things that the variants share in common (both resources and a common customization of those resources), and the overlays declare the differences.&lt;/p&gt;

&lt;p&gt;You then create an overlay (or patch; patch.yaml) that contains the configurations you want to override, and then build your edited manifests, and deploy your Kubernetes cluster, with &lt;code&gt;kubectl apply -k&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the end, your source tree looks something like this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your-app/
├── base/
│   ├── configmap.yaml
│   ├── deployment.yaml
│   ├── service.yaml 
│   └── kustomize.yaml 
└── overlays/
    ├── production/
        ├── deployment.yaml
    │   └── kustomize.yaml 
    └── testing/
        ├── deployment.yaml
        └── kustomize.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Kustomize also has some advanced capabilities, like generators for ConfigMaps and Secrets, that allows you to create them from files or literals.&lt;/p&gt;

&lt;p&gt;You can find more details about Kustomize in the Kubernetes documentation and the kustomize repo:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/kubernetes-sigs/kustomize" rel="noopener noreferrer"&gt;kubernetes-sigs/kustomize: Customization of kubernetes YAML configurations (github.com)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kubectl.docs.kubernetes.io/references/kustomize/" rel="noopener noreferrer"&gt;Kustomize | SIG CLI (kubernetes.io)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The challenges of using Kustomize
&lt;/h2&gt;

&lt;p&gt;While Kustomize simplifies development workflows around creating patches for commonly-reused manifests and Kubernetes resources, it’s not without some of its own headaches.&lt;/p&gt;

&lt;p&gt;Primarily, Kustomize necessitates &lt;em&gt;even more&lt;/em&gt; YAML files to create, edit, and maintain. You have not only your base files, which you might have developed yourself or “borrowed” from an open-source vendor/repository, but also at least one &lt;code&gt;kustomization.yaml&lt;/code&gt; file &lt;em&gt;and&lt;/em&gt; more than one `&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n72ki8xcbcthp9mnb3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4n72ki8xcbcthp9mnb3d.png" alt="Image description" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;` file. In the example above, you’ve gone from 3 YAML files that define &lt;em&gt;everything&lt;/em&gt; to at least 5 YAML files, which are now intricately linked. You can’t fully understand your Kubernetes cluster unless you examine both the bases and the patches.&lt;/p&gt;

&lt;p&gt;The complexity behind those relationships matters a lot when you’re debugging and validating the output of your manifests. If you try deploying and get an error in response, even a &lt;a href="https://kubeshop.io/blog/common-errors-found-in-kubernetes-manifests" rel="noopener noreferrer"&gt;common Kubernetes error&lt;/a&gt;, it won’t be immediately clear whether said error comes from your base or a patch. You’ll have to spend time, and probably a few tweak-deploy-tweak-deploy cycles to get things right.&lt;/p&gt;

&lt;p&gt;Furthermore, the Kustomization files need their own lifecycle. You need to store and manage them separately, as the underlying manifest files evolve with time, and you will need to create new versions to adapt your customization to new structures and values.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does Monokle’s Manifest IDE help?
&lt;/h2&gt;

&lt;p&gt;First off, let’s get clear on what &lt;a href="https://monokle.kubeshop.io/" rel="noopener noreferrer"&gt;Monokle&lt;/a&gt; and a Manifest IDE are. Monokle is an open source cross-platform desktop app for managing Kubernetes configuration files (like manifests) simplifying your everyday development tasks to help you deploy faster and safer. Monokle gives you a high-level view of your manifests, their resources, and their relationships, while abstracting away a ton of YAML’s inherent complexity and syntax issues.&lt;/p&gt;

&lt;p&gt;But, when it comes to &lt;a href="https://kubeshop.github.io/monokle/kustomize/" rel="noopener noreferrer"&gt;Kustomize&lt;/a&gt;, there’s even more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Visualize the scope and relationships of your Kustomizations
&lt;/h2&gt;

&lt;p&gt;The moment you add or select a folder containing one or more kustomization.yaml files, Monokle automatically highlights one of the files, visualizes all its “downstream” Kustomizations and resources in the &lt;strong&gt;Navigator&lt;/strong&gt;, and shows the YAML of the Kustomization in the &lt;strong&gt;Editor&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiesacqtpqfk9zvsu71tv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiesacqtpqfk9zvsu71tv.png" alt="Kustomize flow" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this three-panel view of your Kustomize files, you can quickly explore the scope of a Kustomization by viewing incoming/outgoing links, quickly jumping between interconnected resources, and editing YAML files directly based on your findings.&lt;/p&gt;

&lt;p&gt;No more exploring through nests of patch/overlay folders and bringing up many files side-by-side (or in a grid of four boxes!) to understand how one tweak affects the rest of your deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preview and debug Kustomize resources
&lt;/h2&gt;

&lt;p&gt;Monokle can perform a quick dry-run of your bases and patches to preview the generated resources, which helps you understand what would actually get installed on your Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;Hover over a Kustomization file to reveal the &lt;strong&gt;Preview&lt;/strong&gt; button, which runs kustomize apply -k on that specific file to perform a dry-run and generate the possible output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbh9o73hl0mv8dojpfqcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbh9o73hl0mv8dojpfqcx.png" alt="Monokle Kustomize Preview" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can now explore all the generated resources and resource links, which streamlines the debugging process. If you edit the content of a previewed kustomization.yaml file, click the &lt;strong&gt;Reload&lt;/strong&gt; button to recreate the preview for immediate visibility into how your latest tweak will get installed on your destination cluster.&lt;/p&gt;

&lt;p&gt;No more applying your manifests with kubectl repeatedly trying to pin down the origin of a bug created by the obscured network of manifests that Kustomize generates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example: Kustomizing a vendor-supplied manifest
&lt;/h2&gt;

&lt;p&gt;Let’s run through an example on how you might use Monokle’s manifest features at scale.&lt;/p&gt;

&lt;p&gt;Imagine you want to deploy an off-the-shelf Kubernetes manifest from a trusted vendor, which will become your base file. You want to apply some modifications to it but you want to avoid forking too much from the original file and its subsequent versions. To get the result you want, you can put that file into a base/ folder, and create an overlay/ folder to hold the Kustomize files tailored for your target environments. Some simple kustomization.yaml files to define the base and the overlays, and the required patch.yaml files to override specific configurations of the vendor’s manifests. This is a lot of steps.&lt;/p&gt;

&lt;p&gt;Monokle greatly simplifies the process and reduces the chance of errors helping you manage all the manifests you edit. By previewing them in real-time to debug your Kustomizations, you can rest assured that everything works before you try deploying to production.&lt;/p&gt;

&lt;p&gt;If at a later stage you hear that your vendor has just released a new version of their manifest with some new features you’ve been eagerly waiting for, you can use Monokle to quickly update and otherwise breaking changes in your customizations to make them work again.&lt;/p&gt;

&lt;p&gt;To roll out a new version of your existing manifest files, put Monokle into Preview mode to generate the resources and source code. This will reveal exactly where the breaking change impacts your Kustomization. Monokle’s editor will make it easy for you to edit your patch and use the preview to make sure that you have a successful dry run without needing to test it on your Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;You can even investigate a step further by running a &lt;strong&gt;Diff&lt;/strong&gt;, which shows you exactly what changes will get pushed to your cluster’s deployments for one last validation before you hit &lt;strong&gt;Deploy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Monokle simplifies the management of configuration files, including manifests, customizations and overlays, so you can focus on development and reduce the impact of changes on your dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start Kustomizing with Monokle
&lt;/h2&gt;

&lt;p&gt;To get started, hop on over to our &lt;a href="https://monokle.kubeshop.io/download" rel="noopener noreferrer"&gt;downloads page&lt;/a&gt; to get Monokle for macOS, Windows, or Linux. In order to run the preview functionality, you’ll also need &lt;a href="https://kustomize.io/" rel="noopener noreferrer"&gt;Kustomize installed&lt;/a&gt; locally (follow the instructions to do so in your operating system)&lt;/p&gt;

&lt;p&gt;Join us on &lt;a href="https://discord.gg/6zupCZFQbe" rel="noopener noreferrer"&gt;Discord&lt;/a&gt;! We’re happy to answer any questions about managing your Kustomizations through Monokle. We’re building our community, learning about your workflows, and imagining new features to make Kubernetes development simple again.&lt;/p&gt;

&lt;p&gt;Let us know your &lt;a href="https://49x902y6r6t.typeform.com/to/vkFBEYYt" rel="noopener noreferrer"&gt;feedback and ideas&lt;/a&gt; so we can make Monokle even more awesome and cover more of your use cases.&lt;/p&gt;

</description>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>If you know nothing about Git, know this!</title>
      <dc:creator>Sergio Ocón-Cárdenas</dc:creator>
      <pubDate>Thu, 24 Nov 2022 18:12:07 +0000</pubDate>
      <link>https://forem.com/kubeshop/if-you-know-nothing-about-git-know-this-1i8d</link>
      <guid>https://forem.com/kubeshop/if-you-know-nothing-about-git-know-this-1i8d</guid>
      <description>&lt;h2&gt;
  
  
  If you know nothing about git, just know this!
&lt;/h2&gt;

&lt;p&gt;Have you heard about Git but you don’t want to read a 500 page long document about it? Are you happy with just enough knowledge about how it works or just need to refresh the core concepts? Have you gone through some books and tutorials and you are still confused about some basic concepts?&lt;/p&gt;

&lt;p&gt;If the above describes you, then this article is perfect for you! This post is not intended to be a complete description of what Git is and how to use it, but rather a description of a few concepts that can be useful if you are new to Git. If you’re interested in gaining a deep understanding of Git, you should look at the official reference book and some of the many courses available about the topic: &lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;Git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is also a free e-book recommended by Git called &lt;a href="https://git-scm.com/book/en/v2" rel="noopener noreferrer"&gt;Pro Git Book&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And of course, the Github docs are a great source for more details about forking a repo and using it in the Github workflow (where there is an introduction on PR). Although there are other methods, this one is quite common in Open Source.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/get-started/quickstart/fork-a-repo" rel="noopener noreferrer"&gt;Fork a repo — GitHub Docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our team, we use &lt;a href="https://www.conventionalcommits.org/en/v1.0.0/" rel="noopener noreferrer"&gt;Conventional Commits&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Git?
&lt;/h2&gt;

&lt;p&gt;Git is a tool for software version management that is used by millions of developers both in the command line and using different GUI. It is also in the core of GitOps and other Git based infrastructure and configuration management workflows. Knowing Git is a key requirement for professional development, and as of late, for proficiency in environments using Infrastructure as Code.&lt;/p&gt;

&lt;p&gt;In Monokle, we have identified a market need for better tools that can leverage Git to support configuration version management. We asked around and discovered that some people on our team, who were not developers, did not know enough about it. Not only that, Kubernetes is used and managed for non-developers, like operators that are not familiar with software version management, TDD, BDD, and other similar topics that make it easier to work with software artefacts&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kh52jqqr1mskacaaui2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7kh52jqqr1mskacaaui2.png" alt="Image description" width="668" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, I decided to write a small article about the most basic concepts needed to understand what Git is and how it works, without going into the details of the really hard things, like conflict management.&lt;/p&gt;

&lt;p&gt;I hope you like it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started with Git
&lt;/h2&gt;

&lt;p&gt;Git is used for distributed software version control meaning it is a system that records changes to files or sets of files so you can recall a specific version later. It can store changes in any kind of files, although it will normally be used for software source code. (Be careful, as binary files are not easy to compare and diff and they usually occupy a lot of space).&lt;/p&gt;

&lt;p&gt;In the past, it was normal to have source version control systems where one server stored the data. You simply connected to download and upload the version you were working with. But recently, that has been abandoned in favor of distributed systems. What distributed means is that any time you make a copy of the files to another server, you are creating a full mirror of everything, a full copy and not just a subset. Any “clone” is thus a full backup and can work with different workflows, with or without other masters, and even serve as a new master file if you need it to.&lt;/p&gt;

&lt;p&gt;For instance, you could have different versions of your design documents, or a full version of all the different rewritings of your latest novel.&lt;/p&gt;

&lt;p&gt;‍&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxqrztkzuqb4j258uj51.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuxqrztkzuqb4j258uj51.png" alt="Image description" width="668" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Git repositories
&lt;/h2&gt;

&lt;p&gt;Git works with &lt;strong&gt;repositories&lt;/strong&gt;, that are the basic elements that get updated and synchronised as you work. Repositories are folders with files inside containing some metadata. It is possible to tell Git to ignore some of the files included if you don’t want to share them (i.e. binary files, secrets, OS specific files, and anything that is specific to you and not to the source code).&lt;/p&gt;

&lt;p&gt;There are two ways to obtain a Git repository:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You can turn a local directory into a Git repository (&lt;em&gt;git init)&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can &lt;strong&gt;clone&lt;/strong&gt; an existing repository that is stored in another place. This will create a local copy with all the metadata already in place.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In both cases, you end up with a folder containing files and some amount of metadata inside a &lt;em&gt;.git&lt;/em&gt; subdirectory at the base of your folder. That subdirectory stores information about every file and modification done to it. It is efficient because it mostly stores the differences (which is why binaries are not a good fit for this).&lt;/p&gt;

&lt;p&gt;There is a catch: &lt;em&gt;files are NOT automatically added to a repository when you create it&lt;/em&gt; You need to manually add them so they are tracked. And, in addition to that, files are not automatically updated in the Git metadata so you have to manually trigger a sync.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recording changes to files
&lt;/h2&gt;

&lt;p&gt;Files need to be tracked and updated. You can actually work on a file without Git storing the changes in the metadata (compare that with Google Docs where every change is stored automatically as a new version every few seconds), so you know in each moment the state of your files:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylkwq10hczpnoy9nx1nh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylkwq10hczpnoy9nx1nh.png" alt="Recording changes" width="800" height="689"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can know the state of any file and folder in a repository using Git status&lt;/p&gt;

&lt;p&gt;Files follow a flow inside Git and can be in different states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;By default any file in the repo is &lt;strong&gt;Untracked&lt;/strong&gt; and Git won’t store any information about it. The output of Git status will show as &lt;em&gt;Untracked files&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can &lt;em&gt;add&lt;/em&gt; files and folders to be tracked by Git, putting them in the &lt;strong&gt;staging&lt;/strong&gt; area. When you stage a file, you store a snapshot of the information in Git but you are still not following the history of those changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you add a file several times, and you edit and stage it again, you will stage only the last snapshot. Adds a snapshot of every file in the directory: git add .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adds a snapshot of the file or folder: git add &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In order to be able to store and manage versions of a file, you must &lt;strong&gt;commit&lt;/strong&gt; a new version.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Committing will create a new version in the history of every file that is staged and identify that version with a hash.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;At that moment, the stage and commit files will be equivalent. &lt;code&gt;git commit -m &amp;lt;commit message&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git commit will ask for the commit message&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can edit a file at any moment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If the file is &lt;em&gt;Untracked&lt;/em&gt;, it will continue to be so.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the file is &lt;em&gt;Staged&lt;/em&gt;, Git will identify it as &lt;em&gt;Modified (and will keep a snapshot)&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the file is &lt;em&gt;Committed&lt;/em&gt;, Git will identify it as &lt;em&gt;Modified&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A file can be in all of these stages at the same time:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Modified&lt;/em&gt;: the filesystem version is not the same as the staged one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Staged&lt;/em&gt;: the staged version has not been committed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Committed&lt;/em&gt;: there is a version that has been included in a commit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You always commit the stage version, even if a modified version exists, so you don’t forget to add it before committing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is possible to work with the different versions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You can copy a modified version to stage and from stage to the working version.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can commit a staged version as part of a commit and you can copy a committed version to stage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can ignore a file so it does not appear in your status (this comes in handy to avoid .DS_Store files or binary outputs to be committed so as not to occupy space).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Files are ignored using a .gitignore file in the folder that tells Git to ignore some patterns (like *.a) or track a file even if you are ignoring it with another pattern (!mylib.a).&lt;/p&gt;

&lt;p&gt;It is even possible to get a report on every change in and out of stage and commit. &lt;code&gt;git diff&lt;/code&gt; - Will report on addition and subtraction to all files&lt;/p&gt;

&lt;h2&gt;
  
  
  Commits and branches
&lt;/h2&gt;

&lt;p&gt;Commits are stored in the history of Git and can be identified with a unique identifier (SHA-1 checksum) that works as a history line. A commit stores the changes from a previous commit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwf47o3ngzpuw17aoxo8f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwf47o3ngzpuw17aoxo8f.png" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Commits can be seen using the log command, which will show a list of all the commits in reverse chronological order starting with the most recent commits first. ‍ git log&lt;/p&gt;

&lt;p&gt;Commits are great to compare different versions. You can compare at any time, any commit with another commit and see the difference between commits, too.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git diff 0be526a 161bec8&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you want to go back to a previous version, you can fix a commit using Git revert which will create a new commit that reverts the changes made by other commits. This won’t change your history, because the history will add a new commit that will undo the changes, but the previous commits will still be there.&lt;/p&gt;

&lt;p&gt;If there were no mistakes and you always knew exactly what was the next step, this would be a great way of knowing what you have done and go back to it. Basically, you never lose any change committed and you can work on top of any version stored. A single history line, however, can be too limited if you want to explore or fix things without breaking the code.&lt;/p&gt;

&lt;p&gt;Sometimes, you want to be able to store different parallel versions of the same docs. For instance, you are working on the new version of the application while you are working on the existing version, and thus, you need to be able to switch from the different versions of your application. In Git, these actions are called &lt;strong&gt;branches&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Each commit stores the version of the files that exists in the staging area, some information about the user, and other metadata, with a pointer to the content (blobs) and the directory (tree), and a pointer to the commits that come before.&lt;/p&gt;

&lt;p&gt;A branch is then a movable pointer to one of those commits. The default branch is &lt;em&gt;main&lt;/em&gt; (although it used to be &lt;em&gt;master&lt;/em&gt; so you can find some repos that still use that name), but it makes no difference what branch you use as the basic branch, they are all the same. Each branch is just a history of commits, some of them shared between branches.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bikkynv8s1egjy3s4gz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bikkynv8s1egjy3s4gz.png" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you create a new branch, a new pointer is created (dev), but now you have to choose between two different branches that share commits. So, we need to know exactly what story we are reviewing: that is what HEAD does for us, it points to one of the branches.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Creates a new branch called dev: git branch dev&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Changes head to the new branch: git checkout dev&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Changes back to main: git checkout main&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From the moment we take the snapshot, whatever branch we are in will be &lt;strong&gt;the&lt;/strong&gt; branch. Everything we have done so far will continue working.&lt;/p&gt;

&lt;p&gt;For instance, we will be able to have two separated histories in each branch that evolve differently, with the same workflows (staged, modified, committed).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpew3hsr8a18mcomxxkr7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpew3hsr8a18mcomxxkr7.png" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The main reason to create a new branch is either to maintain a completely separated codebase (i.e. version 1 and 2 of our application), or to work in a feature without affecting the work of others, maintaining a working shared history (the main branch).&lt;/p&gt;

&lt;p&gt;When you want to add changes in one branch to another, the way to do that is to &lt;strong&gt;merge&lt;/strong&gt; one branch into another.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to the main branch: git checkout main&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apply the new commits from dev into main: git merge dev&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febdyilp4szpsd0vvv401.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Febdyilp4szpsd0vvv401.png" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, if I want to merge a branch into another to create a new history that includes the commits from those two branches, there are three scenarios to keep in mind:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The dev branch is basically a set of commits ahead of the main branch. After merging, the main branch is fast forwarded to the same commit that was in dev. Dev remains the same. Main now is equivalent to dev.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The main branch has more commits, but they are not conflicting with the ones in the dev branch. After the merge, the commits in both branches are added to main. Dev remains the same. Main now includes all the commits from dev (and perhaps some others) and the originals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The main branch has different commits that modify the same files that dev, and thus there is a conflict. Git won’t know what to do (you can define a merge strategy so it can guess), so sometimes it will ask you to fix the problem by showing you the conflicts and asking for your inputs for resolution. Dev remains the same. Main will have the commits from main and dev, and another to fix the problems found.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb2kjzdbetuz03xocat7n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb2kjzdbetuz03xocat7n.png" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Merging a branch ahead of main is only a fast forward of the pointer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fweedufsvksav5cimke7m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fweedufsvksav5cimke7m.png" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Merging a branch with a different history creates a new commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Remotes
&lt;/h2&gt;

&lt;p&gt;So far, the developer (or designer) is working on a single computer. How can we share the code between developers if they are not working on the same computer? What happens when the code is stored in some other server (like GitHub or GitLab)? There must be a process to make sure that you have the code that is up to date with other versions of the same code and that you can publish your history to share with others. In Git, that means cloning a repository and fetching or pulling from it and pushing changes.&lt;/p&gt;

&lt;p&gt;You can create a local copy cloning a remote repo that will create a copy of all the information in there except from webhooks and other server related configurations. It will be &lt;em&gt;your&lt;/em&gt; copy and you can work with it as it is yours. [ We will be using Github but you can use Gitlab or any other Git server ].&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;git clone &lt;a href="https://github.com/kubeshop/monokle" rel="noopener noreferrer"&gt;https://github.com/kubeshop/monokle&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That creates a pointer to a remote repo that by default will be named _origin _so you can compare your copy with the one stored. You can see the remotes configured and even havemore than one to work with.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git remote&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;git remote -v&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can use Git remote to add and delete remotes and you can have more than one remote for the same repo. This will become important afterwards when you want to do a pull request.&lt;/p&gt;

&lt;p&gt;Getting additional information is easy. Simply fetch the new data from the remote repo.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;git fetch origin&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Taking this step will create new local branches for the remote branches as origin/main, origin/dev, etc. It won’t change your local history, rather it will create new copies of the remotes in your local repo so you can decide what next step you’d like to take.&lt;/p&gt;

&lt;p&gt;At that moment you can do whatever you want with the branches including merging them into your local branch.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Get the branches from origin: &lt;code&gt;git fetch origin&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change HEAD to the main branch so next actions happen there: git checkout main&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Merge the remote history into our current branch: &lt;code&gt;git merge origin/main&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Depending on your strategy for branches, it is quite possible that merging your main branch will be a fast forward (more lately).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Even if everything is fine this is not a nice workflow, you need to change branches. If you are developing in your own branch, you will have to copy unstaged changes before changing branches, download the new changes, merge them, and go back to your working branch, and do that every time you are synchronizing your state with that of the server. Fortunately, there is a shortcut that will fetch the data from the server and try to merge into your current code in one go:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git pull origin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So now you have worked locally and fetched the new data merging it into your branch. You should have run your tests and everything is working. Now, you are ready to share your work with the world. In Git, you &lt;strong&gt;push&lt;/strong&gt; your history to the remote server for a specific branch:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push &amp;lt;remote&amp;gt; &amp;lt;branch&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Rules for pushing to different places are complicated. To get started, you will only be able to push your code if you can actually fast forward the remote to yours.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pull requests
&lt;/h3&gt;

&lt;p&gt;Now, this is becoming more exciting! You have a working branch with your new code or fix and you want to make sure that everybody will work with that version. There are lots of ways of doing that, but at least in Open Source, and GitOps, you achieve the goal through &lt;strong&gt;pull requests&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In a pull request, you ask another developer to merge a branch into the shared repo. The main thing to keep in mind here is that before merging the PR, somebody will have the chance to review the code, discuss with the author how it has been implemented, ask for changes, or sometimes even alter it. In many cases, automatic testing and policies are applied to help with the discussion (i.e. to make sure that the code is following the proper format agreed by the team that all tests are passing, that there is no component that is introducing a security risk, etc), and sometimes more than one reviewer needs to give its ok to the new code.&lt;/p&gt;

&lt;p&gt;Moreover, because pull requests work from one branch into a different fork of the code, you don’t have (and you don’t need) access to the original repo. You can accept changes from third parties, friends and family, or anybody wanting to improve the code in a truly open source way. You do that by forking the code, creating a full copy that is not a distributed copy of the original code but your own version of it. You can do it directly in the command line cloning a repo or in the Github interface. There is a button to create a fork in your profile or in any group that you have the proper access to.&lt;/p&gt;

&lt;p&gt;You then can create a PR to ask for that merge from your branch in your fork into one branch in the forked repo (mostly main but again, branches are the same for git, it can be any).&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Git is a very powerful tool that is underpinning DevOps and GitOps in Kubernetes. Although used by many, the concepts are sometimes not fully understood and it is always good to have a quick refreshment of the key points to ensure best practices.&lt;/p&gt;

&lt;p&gt;This article only describes the happy path of a Git workflow so you can start talking about it. In Monokle, we are working to create tools that allow GitOps and DevOps on Git in Kubernetes and we would love to hear your view on it.&lt;/p&gt;

&lt;p&gt;Visit us to learn more about how to &lt;a href="http://monokle.io/" rel="noopener noreferrer"&gt;simplify your Kubernetes deployment configuration&lt;/a&gt; or join the conversation in our &lt;a href="https://discord.com/invite/6zupCZFQbe" rel="noopener noreferrer"&gt;Discord server&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We also invite you to collaborate with us to improve our code in our &lt;a href="https://github.com/kubeshop" rel="noopener noreferrer"&gt;Github repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://monokle.io/blog/monokle-basic-git" rel="noopener noreferrer"&gt;https://monokle.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>tooling</category>
      <category>community</category>
    </item>
    <item>
      <title>Advance Git - Git For GitOps</title>
      <dc:creator>Sergio Ocón-Cárdenas</dc:creator>
      <pubDate>Thu, 24 Nov 2022 17:59:49 +0000</pubDate>
      <link>https://forem.com/kubeshop/advance-git-git-for-gitops-3nd9</link>
      <guid>https://forem.com/kubeshop/advance-git-git-for-gitops-3nd9</guid>
      <description>&lt;h2&gt;
  
  
  Advance Git — Git to Work with GitOps
&lt;/h2&gt;

&lt;p&gt;Soon after you master the &lt;a href="https://kubeshop.io/blog/monokle-basic-git" rel="noopener noreferrer"&gt;basics of Git&lt;/a&gt; — creating a repository, committing changes, pushing to remotes, and creating pull requests — you’re bound to quickly run into situations where you need to run more than git add . and git push origin main.&lt;/p&gt;

&lt;p&gt;At the same time, if you jump straight into the &lt;a href="https://git-scm.com/docs" rel="noopener noreferrer"&gt;reference documentation&lt;/a&gt;, you’ll quickly find yourself lost in every complex nook and cranny of Git, like stashing, cherry-picking patches, adding submodules, and more. Those things are useful but are not really needed on a day to day basis.&lt;/p&gt;

&lt;p&gt;This piece is for every developer and DevOps admin who’s in-between. You’re certainly not a beginner, but not an expert (yet) either, and you just want to master new problems and streamline the processes you’ve already embarked on. And we’ll get you exactly the information you need to be even more productive and elaborate with your version control tactics without sacrificing your development velocity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Merge (or rebase!) your code
&lt;/h2&gt;

&lt;p&gt;The standard way of working on features, specially when more than one developer collaborates, is to &lt;a href="https://kubeshop.io/blog/monokle-basic-git#commits-and-branches" rel="noopener noreferrer"&gt;create a new branch&lt;/a&gt; in Git with the intention of merging your code back into your primary development branch, which, these days, is most often called main. There are many strategies for this (from git flows to truck based development) that we won’t be covering here.&lt;/p&gt;

&lt;p&gt;If everything goes to plan on your new branch, the process looks something like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Make changes to your code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stage your changes with git add&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commit your changes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Push your changes to your remote&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Merge your new branch withmainand repeat the cycle&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But you need to be prepared when things &lt;em&gt;don’t go to plan&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Amend
&lt;/h2&gt;

&lt;p&gt;Let’s say you just hit Enter on your most recent commit and realized you did something wrong. You can change your last commit by replacing it with a new commit, which also creates a new commit hash, or &lt;strong&gt;ref&lt;/strong&gt;. that substitutes the previous one.&lt;/p&gt;

&lt;p&gt;You can use it to update your commit message:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit --amend -m "Your updated commit message"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Or, if you forgot to stage a file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add your-file.txt

git commit --amend --no-edit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;As this changes history, it is bad practice to do it if you have pushed your changes into a remote server, as other people can be working on a different version of the history. You will have to –force your new history to push it to a remote server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F384xtqdm97tog5nqorcg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F384xtqdm97tog5nqorcg.png" alt="Image for git amend" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Unstage
&lt;/h2&gt;

&lt;p&gt;If you already staged a file using git add, Git doesn’t force you to commit it. When you are sharing your history with other people, sometimes it can be useful to make your history reflect the way you work, and commit the files in different commits instead of in one big step. What happens when you commit a file that you want to add to your history to a later stage? Well, you can unstage these files, which prevents them from being committed, but retains the changes you’ve already made.&lt;/p&gt;

&lt;p&gt;If you have a single file you want to unstage, use git restore:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git restore --staged &amp;lt;your-file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can unstage &lt;em&gt;all&lt;/em&gt; your changes with a single command and get back to the original content before your changes:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git reset &amp;lt;your-file&amp;gt;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Unmodify
&lt;/h2&gt;

&lt;p&gt;If you’ve modified a file but &lt;em&gt;haven’t&lt;/em&gt; yet staged or committed it, you can use the same technique:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git reset &amp;lt;your-file&amp;gt;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Merge
&lt;/h2&gt;

&lt;p&gt;If you’re using a platform like GitHub for code collaboration, you probably won’t be doing much manual merging of branches, but it’s still an important process you should be familiar with.&lt;/p&gt;

&lt;p&gt;It’s also important to recognize that, behind the scenes, Git merges your code every time you run git pull to incorporate changes from your remote.&lt;/p&gt;

&lt;p&gt;Let’s run through the most common example of manual merges: Combining the work you’ve completed on two local branches before you push to your remote and engage in any code collaboration via GitHub or another platform. You currently have your main branch checked out and want to merge in your changes from new-feature.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fengd9i39hyobxkqwa6pz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fengd9i39hyobxkqwa6pz.png" alt="Image for git merge" width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git merge new-feature&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Git will replay the commits you made on the new-feature branch on top of what’s changed in the main branch, creating one more commit that combines the latest state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjyq61jksvo42lls8fudi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjyq61jksvo42lls8fudi.png" alt="git merge continued" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;‍&lt;/p&gt;

&lt;p&gt;If there are &lt;a href="https://monokle.io/blog/advanced-git#heading=h.toj6s47t9ywc" rel="noopener noreferrer"&gt;conflicts&lt;/a&gt;, you’ll have to deal with them manually.&lt;/p&gt;
&lt;h2&gt;
  
  
  Rebase
&lt;/h2&gt;

&lt;p&gt;When you merge branches, you write new commits into your repository’s historical record and move on from there, as you see in commit Z from the diagram above. A rebase solves the same problem as a merge — you integrate changes from one branch into another — but when you rebase, it’s more like *rewriting and cleaning up *history.&lt;/p&gt;

&lt;p&gt;You’re most likely to rebase when you’ve worked in a development branch for a while, but your main branch has also progressed in parallel. You want to include these new changes into your branch—perhaps you could benefit from a recently-merged bugfix or UI improvement—but you don’t want to create a new and possibly messy merge commit. Instead, rebasing allows you to &lt;em&gt;replay&lt;/em&gt; your changes on top of the latest state of main, integrating not only their code, but also their histories.&lt;/p&gt;

&lt;p&gt;Let’s assume your Git history looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdpjl2rzbjkwdrgdzumf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdpjl2rzbjkwdrgdzumf.png" alt="git rebase 1" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From your new-feature branch, you run the following on the branch new-feature:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git rebase main`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Your Git history ends up looking like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiby81ba7l8b07jqz92ct.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiby81ba7l8b07jqz92ct.png" alt="git rebase 2" width="800" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From Git’s perspective, you’ve now changed the beginning of your branch from commit T to commit V, allowing you to continue developing from the most up-to-date history. The two big benefits of rebasing is that your branch’s history is cleaner, as though you started working from the latest main from the get-go, and you get a cleaner merge when you’re ready to integrate the branches.&lt;/p&gt;

&lt;p&gt;Now a git merge will consist of a fast forward of main to the latest commit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resolve conflicts
&lt;/h3&gt;

&lt;p&gt;Whether you’re merging or rebasing, you’ll encounter situations where Git’s merging algorithm can’t reliably handle without potentially breaking your code. You need to resolve these conflicts, telling Git which version of your code is more up-to-date or “correct” before you can push to your remote.&lt;/p&gt;

&lt;p&gt;Git informs you of the conflicting file(s), at which point you need to open them, find the line(s) of code that are affected, delete the outdated code, and retain the version that’s more up-to-date or “correct.” Once you’ve resolved a conflict, you can save the file(s), stage with git add, and then continue the process with one of the two commands:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git merge --continue`

`git rebase --continue`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You may have to resolve conflicts multiple times — particularly when rebasing — but keep cycling through the process until you’ve fully integrated your branches!&lt;/p&gt;

&lt;h3&gt;
  
  
  Find branches that have been merged with the current
&lt;/h3&gt;

&lt;p&gt;After you’ve been developing for a while, creating many new branches and eventually merging them into main, you’ll inevitably start to clutter up your repository with obsolete or outdated branches. When you run git branch, or &lt;em&gt;attempt&lt;/em&gt; to use your terminal’s autocomplete feature to checkout a branch, it inundates you with irrelevant options.&lt;/p&gt;

&lt;p&gt;` example-101&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  exciting-new-feature

* main

  refactor

  strange-bug

  strange-bug-2

  …`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Because your local branches might contain code you want to keep and merge later, you don’t want to start deleting branches without taking some precautionary steps first.&lt;/p&gt;

&lt;p&gt;If you want to see which branches you’ve merged into the latest commit on main:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git branch --merged main`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Once you know your code is safely inmain, you can delete branches with &lt;code&gt;git branch -d &amp;lt;branch-name&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tag important points in your Git history
&lt;/h2&gt;

&lt;p&gt;Now that you’re developing, committing, merging, and rebasing with more confidence, with the knowledge to circumvent any mistakes you might make, you’re getting to the point where you should start to create more organization around your project’s history.&lt;/p&gt;

&lt;p&gt;Git might be a version control system, but it doesn’t automatically create the kind of &lt;em&gt;versions&lt;/em&gt; we’re more used to seeing, downloading, and interacting with — think milestones like v1.0, v4.0.8, v183.22.8, and more. These version numbers, whether you follow the &lt;a href="https://semver.org/" rel="noopener noreferrer"&gt;semantic versioning scheme&lt;/a&gt; or any other, help you, collaborators, and end users understand the state of the software they’re creating or using.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: Git tags aren’t limited to version numbers alone — you can tag a commit with any string you’d like.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We recommend creating an annotated tag to include metadata, like your Git username, email, date, and a short message. To create a tag based on the current HEAD:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git tag -a v1.2.0`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Once you’ve created one or more tags, you can list them with git tag.&lt;/p&gt;

&lt;p&gt;Another important note is that tags aren’t pushed to your remotes by default, which means you need to do so explicitly:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git push origin v1.2.0`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The benefit of pushing your tags to your remote is that others can check them out explicitly without having to know a specific ref:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git checkout v1.2.0`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Fix errors by rolling back history
&lt;/h3&gt;

&lt;p&gt;Sometimes, despite your best intentions, you let errors or bugs make their way into the current commit of yourmain branch. And sometimes, you can’t afford to spend time with a formal process of troubleshooting, fixing, testing, and deploying a bugfix branch—for example, if you use CI/CD to deploy the latest commit to production automatically.&lt;/p&gt;

&lt;p&gt;In these cases, your best bet might be to roll back the state of your repository to a previous commit you know works.&lt;/p&gt;
&lt;h3&gt;
  
  
  Finding a previous commit
&lt;/h3&gt;

&lt;p&gt;First, you need to find the old commit. Either of the following commands will display your repository’s commit history, all the way back to its origin, along with the associated commit message. The first command also displays the author, date, and refs involved in a merge, if applicable. The second command displays only the ref and the commit message, allowing you to traverse history a little faster.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git log`

`git log --oneline`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Once you find the previous commit, take note of its ref, whether the shortened or long version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rolling back to your chosen commit
&lt;/h2&gt;

&lt;p&gt;Before we talk about *how *to do this, it’s important to clarify some of Git’s terminology around these processes, as they’re quite important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A &lt;em&gt;reset&lt;/em&gt; is like going back in time to a specific commit, effectively undoing and removing all the commits between the two and altering the project’s commit history.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;em&gt;revert&lt;/em&gt; is pulling out a specific commit and leaving a revert commit in its place, then continuing development from there.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the following diagram, you remove commit D and C, rolling back the history to commit B, and then continue your development with E. With a reset, the history is rewritten, while revert will create a new commit that modifies the changes so that the new commit is the same as B (but a new one)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkktq8uxoccfb0cn2ommm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkktq8uxoccfb0cn2ommm.png" alt="git reset" width="800" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknv9d4n8k3pmotk1d4ad.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fknv9d4n8k3pmotk1d4ad.png" alt="git revert" width="800" height="57"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;‍&lt;/p&gt;

&lt;p&gt;Based on how you want to handle your commit history, and whether you need to preserve the work you completed in those intermediate commits in the process, you can take one of two actions:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reset:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`git reset --hard B`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Revert:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git revert B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As we said before, reset is a dangerous command if you have shared your code with others, because it will create inconsistencies between copies of the code, as the histories will be different.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code collaboration on GitHub
&lt;/h2&gt;

&lt;p&gt;GitHub might not be the only place where code collaboration happens, but it’s the most popular platform to do so. Most open source projects host their projects and work with contributors there. GitHub adds some flows to these basic git flows, so it’s important to know where Git’s features end and GitHub’s begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fork a repository
&lt;/h2&gt;

&lt;p&gt;Forking has a long history in open source, but in the context of GitHub, it refers to the process of duplicating a repository under your GitHub account. For example, you find a project at github.com/sandra/projectA, but then create a duplicate at github.com/your-username/projectA. They share the same project name, but they’re managed and maintained by different people—the original creator, and yourself. You are the owner of your copy, so you can modify it and maintain it in the way that you want.&lt;/p&gt;

&lt;p&gt;Forking is necessary when you don’t have write access to the original repository and its remotes and branches, which is almost always the case when collaborating on an open source project. Even when working on an internal project, such as refining the Kubernetes manifests your team uses to deploy your application to production, you might be required to work with a fork of the repository rather than writing directly, so you can do some checks and follow some procedures before committing new code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull requests and merges
&lt;/h2&gt;

&lt;p&gt;On GitHub, code collaboration occurs primarily through &lt;a href="https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests" rel="noopener noreferrer"&gt;pull requests&lt;/a&gt;, which are your way of informing others about the work you’ve completed and asking them to review and merge your code. Pull requests are completely asynchronous, which is a boom for organizations who work remotely and across multiple time zones and blocks of working hours. When you open a pull request on GitHub, your peers and collaborators can comment on your work, review it, make suggestions and comments. Eventually, your code will be ready and somebody will approve your request, and your changes will be merged into your destination branch — most often, that’s going to be main, although there are different strategies for branch management.&lt;/p&gt;

&lt;p&gt;Aside from creating an asynchronous conversation around your proposed changes, pull requests also act as an important check on code quality. Your organization likely requires one or more approvals from your peers to merge any of your pull requests, preventing any developer or engineer from unilaterally merging code.&lt;/p&gt;

&lt;p&gt;Pull requests also trigger CI/CD pipelines, which can trigger even more robust quality checks — we’ll cover those in a moment.&lt;/p&gt;

&lt;p&gt;One important part of the Pull Request process is the code review. We will see later how you can add automation to the workflow, introducing compliance tests that show information about the code, so the review process can be done easier and quicker (i.e. giving you information about whether the commit will still pass the integration tests, or more).&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Actions
&lt;/h2&gt;

&lt;p&gt;Continuous integration and continuous delivery (CI/CD) pipelines have been around for a long time, but mostly as third-party platforms. GitHub now offers its own CI/CD pipeline, &lt;a href="https://github.com/features/actions" rel="noopener noreferrer"&gt;GitHub Actions&lt;/a&gt;, which lets you define how you build, test, and deploy your code.&lt;/p&gt;

&lt;p&gt;You first define, in your repository, which events — pushes, new issues, pull requests, and more — should trigger CI/CD pipelines, and what actions you want GitHub to take on your behalf. You can automatically test your code for compliance with style, security, or testing requirements, which we’ll cover in the next section.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making your code compliant
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Stylize your code with a linter
&lt;/h2&gt;

&lt;p&gt;A linter is a static analysis tool for improving the quality of your code by fixing errors, pointing out stylistic mistakes, or warning you about suspicious patterns. There are linters for every major programming language and tools that care more about code formatting, like &lt;a href="https://github.com/prettier/prettier" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt;. These tools look for configuration files, which you store directly in your repository to apply standards across your codebase. Having a well defined linter means that your lines of code are written in the same style as others, making the code easier to understand and review. It is like your automatic coding style guide, and it is so useful for collaboration that modern languages include their own code formatter and linter (like rust, elixir or go)&lt;/p&gt;

&lt;p&gt;While some of these tools can run directly in your IDE/code editor, creating flags and warnings as you write your code, another powerful way to stylize and correct your code is with a Git pre-commit hook: Every time you run git commit ..., Git runs your tool (linter or formatter) of choice, and stops the commit if that tool returns any errors or warnings, like a failed revision of your PR. It outputs some helpful information about the violation, along with the filename and line number to help you resolve it quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run tests automatically
&lt;/h2&gt;

&lt;p&gt;Continuous integration (CI) is an automated process that builds and tests the code you’ve just committed to prevent bugs and errors from being merged into your main branch. The more often you commit, the more often these tests run, encouraging and enforcing higher quality while keeping your velocity high.&lt;/p&gt;

&lt;p&gt;CI tests can include the linters mentioned above and code coverage, which reveals what percentage of coude you’re currently testing vs. how much &lt;em&gt;you will&lt;/em&gt; test if you merge your branch into main. You can’t use CI directly with Git, but code collaboration platforms like GitHub make it trivial with GitHub Actions. You can also opt for an independent CI/CD platform, like Jenkins, CircleCI, ArgoCD, or dozens of others.&lt;/p&gt;

&lt;p&gt;In many cases, you can define your CI practices directly in your repository and keep them version-controlled alongside the rest of your project, smoothing your onramp into more sophisticated DevOps practices, like GitOps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrate security into your workflow
&lt;/h2&gt;

&lt;p&gt;Linters and code coverage tests help ensure the quality of your code, but they can’t prevent you from deploying inherently insecure code. That’s where security-focused CI/CD pipelines come into play, giving you the power to automatically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Scan your source code for potential vulnerabilities (static application security testing)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Discover which dependencies introduce major security flaws (source composition attacks)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify that all user inputs are not vulnerable to injection attacks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure no secrets, like passwords or keys, are publicly visible&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Tighten access controls on changes to your production infrastructure as code (IaC)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Dependency management
&lt;/h2&gt;

&lt;p&gt;The application you’re building in your Git repository inevitably requires dependencies — open source projects, tools, and protocols — to function correctly. Every framework and language defines and stores dependencies differently, but most can be saved and version-controlled in Git.&lt;/p&gt;

&lt;p&gt;Take, for example, managing dependencies in NodeJS. You create apackage.json file, which defines which packages you need to build and run your application. NodeJS/NPM then creates a package-lock.json/yarn.lock file, which defines your dependencies' dependencies, and stores the packages themselves in the node_modules/ folder. Once you tell Git to ignore that folder by adding it to `.gitignore, you can manage dependencies directly in your repository,&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This piece on advanced Git techniques might seem like a lot if you are new to Git, but we have left a few ones behind that you will be using only in very limited situations. However, it is more and more clear that Git is the right choice to store the history of your application and infrastructure configuration to achieve full auditability and automation. Stay tuned for even more workflows and optimizations that come with a deep understanding of all things Git!&lt;/p&gt;

&lt;p&gt;And in the meantime, we encourage you to check out Monokle, a desktop application that helps DevOps engineers and developers better leverage Git when &lt;a href="http://monokle.io/" rel="noopener noreferrer"&gt;managing and optimizing their Kubernetes deployments&lt;/a&gt; adding a lot of fundamental features to analyze and create your optimal desired state.&lt;/p&gt;

&lt;p&gt;We’re &lt;a href="https://github.com/kubeshop" rel="noopener noreferrer"&gt;fully open-source&lt;/a&gt; and would love to hear about your Git, DevOps, and GitOps journeys on &lt;a href="https://discord.com/invite/6zupCZFQbe" rel="noopener noreferrer"&gt;Discord&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://monokle.io/blog/advanced-git" rel="noopener noreferrer"&gt;https://monokle.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>development</category>
      <category>architecture</category>
      <category>microservices</category>
    </item>
    <item>
      <title>What I Learned at KubeCon North America with Monokle</title>
      <dc:creator>Sergio Ocón-Cárdenas</dc:creator>
      <pubDate>Thu, 24 Nov 2022 17:27:56 +0000</pubDate>
      <link>https://forem.com/kubeshop/what-i-learned-at-kubecon-north-america-with-monokle-17lg</link>
      <guid>https://forem.com/kubeshop/what-i-learned-at-kubecon-north-america-with-monokle-17lg</guid>
      <description>&lt;p&gt;A few days have gone by after Kubecon NA in Detroit and a lot of things have happened during it and after. I spent most of my time in the Monokle booth talking to users, and I learned a lot in the process.&lt;/p&gt;

&lt;p&gt;‍&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw18f555ay8osagi1zsbf.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw18f555ay8osagi1zsbf.jpeg" alt="Image description" width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;
Monokle logo in the startup slide of Kubecon keynote&lt;/p&gt;

&lt;h1&gt;
  
  
  Changes in a web page can derail your SEO
&lt;/h1&gt;

&lt;p&gt;We changed the web page from monokle.kubeshop.io to monokle.io, and our SEO in Google has gone down like crazy. I’ve been told that it will go back to normal in three weeks, once Google discovers that all the content from the webpage and blog has moved to the new URL and reindex all of that.&lt;/p&gt;

&lt;p&gt;I really wasn’t expecting such a hit when there is a redirect from the old pages to the new ones, but it does seem to be the case. Let’s see if we can get quickly back to normal.&lt;/p&gt;

&lt;h1&gt;
  
  
   Kubernetes is hard and there are not so many experts out there
&lt;/h1&gt;

&lt;p&gt;We had many meaningful conversations about requirements and how to improve the experience for Monokle users, and we were surprised by the fact that many of the attendees to Kubecon were hard experts, but they were looking for a way of making their teams work better with it.&lt;/p&gt;

&lt;p&gt;There was a number that we heard a lot: "I have 10x more developers that do not understand K8s than I have experts. So we are looking for ways of making those productive."&lt;/p&gt;

&lt;p&gt;I believe many people are taking a shortcut: “we can make your team more productive by creating an abstraction layer on top of Kubernetes that will make their work easy”, but actually that only works when things are going well because you still have a team or non-experts when they need to dig deeper on the problems you're facing to fix your application when is down.&lt;/p&gt;

&lt;p&gt;The other approach is to create a platform, so developers don’t need to think too much: they get guardrails and a service catalog, and they are free to use it. There are great solutions with this approach, but I still feel it is really hard to maintain a catalog that balances appropriately the need for new things and the need for those things to be secure.&lt;/p&gt;

&lt;p&gt;Our approach (Monokle) is different: we are working with K8s artifacts and making them easier to use in three ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using templates and snippets, and adding documentation in place so we reduce the cognitive workload&lt;/li&gt;
&lt;li&gt;Validating in place in real-time, so you know if you are making a mistake with your schema, or you are not following a best practice of policy, and you can learn why and fix it on the spot&lt;/li&gt;
&lt;li&gt;Keeping the matter in focus. Yes, we provide forms, but you can have the original YAML file in place at the same time because we are not trying to hide what you actually are doing, but reducing the mistakes you make when doing it&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
   We don’t know more than you do, so we research more
&lt;/h1&gt;

&lt;p&gt;We got so much feedback in a few days and we learned so much about what we were trying to do that it is clear that we need to keep our respect high and act accordingly.&lt;/p&gt;

&lt;p&gt;Yes, we got confirmation about many of the things we were trying to do. There is a need for a lot of the features we have, and there is a need for more to make it really really good for your work, but also we learned that there are assumptions we were making that were wrong (like the fact that everybody knows K8s if they are working on the space, that proved to be wrong).&lt;/p&gt;

&lt;p&gt;It is sooo good to talk to real users, face to face (and masks), and get the conversation going.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjjq14fmy9usuwttu6ixl.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjjq14fmy9usuwttu6ixl.jpeg" alt="Image description" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Face-to-face is awesome!&lt;br&gt;
Don’t you think that your meetings were missing something more than what you expected?&lt;/p&gt;

&lt;p&gt;I’ve interviewed a lot of people since I joined Kubeshop, and the feedback was great, but the conversation was always straight to the point. There was even a moment, after months of isolation due to the pandemic, when I felt I was losing the capability to do small talk. On video, all conversations seem to be straight to business. Sounds productive, but it is really not so.&lt;/p&gt;

&lt;p&gt;There is a ton of good information in the context, and we take it for granted over video conference. Yes, I have this problem, but I am also working with a team that has different issues. No, I don’t need that, but I know five people that do. Oh, I see what you have done, and that reminds me of something I was discussing with a friend the other day.&lt;/p&gt;

&lt;p&gt;We want that conversation, and as humans, we thrill on it. Going straight to the point is good when you are dealing with machines.&lt;/p&gt;

&lt;h1&gt;
  
  
   Engineers need to know what is going on in the cluster, but not everybody needs full cluster management capabilities
&lt;/h1&gt;

&lt;p&gt;In our conversations we found a couple of different personas, the seasoned Gitops / DevOps / platform engineer that would be so comfortable using the command line that any tool, and the developers that need basic information about the state of their deployment.&lt;/p&gt;

&lt;p&gt;We know is hard to fulfill the requirements of the first group (and we are working on a CLI for validations that will do exactly that), but we discovered we already have a lot of the features required by the second one (like terminal and log access, cluster inventory management, comparisons, etc).&lt;/p&gt;

&lt;p&gt;We will be doubling down on our efforts to get value out of the things we do with clusters and adding some additional functionality to better help with it.&lt;/p&gt;

&lt;h1&gt;
  
  
  What’s next?
&lt;/h1&gt;

&lt;p&gt;KubeCon North America may be over, but there’s still so much work to do. We need to follow up with many users that had amazing ideas on what we need to do next, and we have a lot of partnership opportunities that we need to materialise into something useful for all.&lt;/p&gt;

&lt;p&gt;There is so many things I would love to be doing that prioritization is going to be hard.&lt;/p&gt;

&lt;p&gt;Next stop: launching Monokle 2.0 and prepare for KubeCon Europe!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3eez6uuwa594lhzpixk1.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3eez6uuwa594lhzpixk1.jpeg" alt="Image description" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can learn more about our work in Monokle by going to &lt;a href="https://monokle.io" rel="noopener noreferrer"&gt;https://monokle.io&lt;/a&gt; and you can try the cloud version at &lt;a href="https://app.monokle.com" rel="noopener noreferrer"&gt;https://app.monokle.com&lt;/a&gt;. Monokle is an open source application, so you can find us at &lt;a href="http://github.com/kubeshop/monokle/" rel="noopener noreferrer"&gt;http://github.com/kubeshop/monokle/&lt;/a&gt; and on our Discord channel.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>kubeconna</category>
      <category>startup</category>
    </item>
  </channel>
</rss>
