Skip to main content

Simple Git 101

Git is a powerful version control system that allows developers to track and manage changes to their code. It is widely used in software development and has become the standard for managing code projects of all sizes. If you're new to Git, this blog post will provide a basic introduction to the key concepts and commands that you need to know to get started.

The first thing to understand about Git is that it is a distributed version control system. This means that every developer who is working on a project has a copy of the entire project history on their local machine. This allows developers to work on the code offline and also makes it easy to collaborate with others, as changes can be easily shared between different copies of the code.

One of the most important concepts in Git is the repository. A repository is a collection of files and directories that are tracked by Git. When you create a new repository, Git creates a special directory called the ".git" directory, which contains all of the information about the history of the code in the repository.

The most basic command in Git is "git init", which is used to initialize a new repository. This command creates the ".git" directory and sets up the repository for version control. Once a repository is initialized, you can start adding files to it and tracking changes.

Another important command is "git add", which is used to add changes to the repository. When you make changes to a file, Git does not automatically track those changes. Instead, you need to use the "git add" command to tell Git to start tracking the changes. Once changes are added, you can then commit the changes to the repository.

The "git commit" command is used to save changes to the repository. A commit is a snapshot of the code at a particular point in time. When you commit changes, you are creating a new revision of the code that can be tracked and referenced later.

Once you have committed changes, you can then use the "git push" command to share your changes with others. The "git push" command sends your commits to a remote repository, such as a GitHub or GitLab server, where they can be accessed and reviewed by others.

These are just a few of the basic commands that you need to know to get started with Git. As you become more familiar with the tool, you can start exploring more advanced features such as branching, merging, and resolving conflicts.

In summary, Git is a powerful version control system that allows developers to track and manage changes to their code. It is widely used in software development and has become the standard for managing code projects of all sizes. Understanding the key concepts and commands can help you to get started with Git and start collaborating with others on your code projects.

 

 


Comments

Popular posts from this blog

Manual Kubernetes TLS certificate renewal procedure

Intro Kubernetes utilizes TLS certificates to secure different levels of internal and external cluster communication.  This includes internal services like the apiserver, kubelet, scheduler and controller-manager etc. These TLS certificates are created during the initial cluster installation and are usually valid for 12 months. The cluster internal certificate authority (CA) certificate is valid for ten years. There are options available to automate certificate renewals, but they are not always utilised and these certs can become out of date. Updating certain certificates may require restarts of K8s components, which may not be fully automated either. If any of these certificates is outdated or expired, it will stop parts or all of your cluster from functioning correctly. Obviously this scenario should be avoided - especially in production environments. This blog entry focuses on manual renewals / re-creation of Kubernetes certificates. For example, the api-server certificate below exp

Deprecating Networking Ingress API version in Kubernetes 1.22

  Intro Kubernetes deprecates API versions over time. Usually this affects alpha and beta versions and only requires changing the apiVersion: line in your resource file to make it work. However with this Ingress object version change, additional changes are necessary. Basics For this post I am quickly creating a new cluster via Kind (Kubernetes in Docker) . Once done, we can see which API versions are supported by this cluster (version v1.21.1). $ kubectl api-versions | grep networking networking.k8s.io/v1 networking.k8s.io/v1beta1 Kubernetes automatically converts existing resources internally into different supported API versions. So if we create a new Ingress object with version v1beta1 on a recent cluster version, you will receive a deprecation warning - and the same Ingress object will exist both in version v1beta1 and v1. Create $ cat ingress_beta.yaml apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata:   name: clusterpirate-ingress spec:   rules:   - http:       path

Analysing and replaying MySQL database queries using tcpdump

Why There are situations where you want to quickly enable query logging on a MySQL Database or trouble shoot queries hitting the Database server in real-time. Yes, you can enable the DB query log and there are other options available, however the script below has helped me in many cases as it is non intrusive and does not require changing the DB server, state or configuration in any way. Limitations The following only works if the DB traffic is not encrypted (no SSL/TLS transport enabled). Also this needs to be run directly on the DB server host (as root / admin). Please also be aware that this should be done on servers and data you own only. Script This script has been amended to suit my individual requirements. #!/bin/sh tcpdump -i any -s 0 -l -w - dst port 3306 | strings | perl -e ' while(<>) { chomp; next if /^[^ ]+[ ]*$/;   if(/^(ALTER|COMMIT|CREATE|DELETE|DROP|INSERT|SELECT|SET|UPDATE|ROLLBACK)/i) {     if (defined $q) { print "$q\n"; }     $q=$_;   } else {