Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Friday, February 17, 2023

Terraform for Dummies | Here's a simple explanation of how it works

 Terraform is a popular open-source infrastructure as code (IaC) tool that allows you to manage and automate your infrastructure resources using a declarative configuration language. With Terraform, you can define your infrastructure as code, making it easier to manage and deploy your resources consistently across various environments.

If you're new to Terraform, here's a simple explanation of how it works:

  1. Define your infrastructure: You define your infrastructure resources in a configuration file using Terraform's configuration language, HCL (HashiCorp Configuration Language). This file is typically named main.tf and contains the details of your resources, such as their type, provider, and configuration options.

  2. Initialize your Terraform environment: Once you have your configuration file, you need to initialize your Terraform environment. This involves running the command terraform init in your terminal or command prompt. This command initializes your Terraform environment and downloads any required plugins and dependencies.

  3. Plan your infrastructure: After you've initialized your Terraform environment, you can run the command terraform plan to create a plan of the changes that Terraform will make to your infrastructure resources. This allows you to review the changes and ensure they are what you expect.

  4. Apply your infrastructure changes: Once you're happy with the plan, you can apply your infrastructure changes by running the command terraform apply. This will make the changes to your infrastructure resources.

  5. Manage your infrastructure: You can use Terraform to manage your infrastructure over time, making changes as needed. When you want to make changes to your infrastructure, you simply update your configuration file and then run terraform plan and terraform apply again.

Overall, Terraform simplifies the process of managing infrastructure resources by allowing you to define them in code, which makes it easier to automate and manage your resources consistently across various environments. With Terraform, you can easily create, modify, and delete resources, making it an essential tool for managing infrastructure in a modern cloud environment.

Powerful GIT commands

 Git is a powerful and widely used version control system that allows developers to manage their code changes and collaborate with others. While it has a lot of features, some commands are more powerful than others. In this blog article, we'll go over some of the most powerful Git commands that every developer should know.


git clone

The git clone command is used to create a copy of a Git repository on your local machine. This command is extremely powerful because it allows you to access the entire history of a project, including all the previous commits, branches, and tags. This can be very useful when you want to work on a project or contribute to an open-source project.


git log

The git log command shows the commit history of a repository. It is a powerful command because it allows you to see all the changes made to a project, including who made the changes, when they were made, and what was changed. This can be useful for troubleshooting, debugging, or tracking down issues in your code.


git branch

The git branch command is used to create, delete, or list branches. It is a powerful command because it allows you to work on multiple features or bug fixes at the same time without interfering with each other. This can be useful for teams or individuals who need to work on different parts of a project simultaneously.


git merge

The git merge command is used to merge two or more branches into one. It is a powerful command because it allows you to combine changes from different branches into a single branch. This can be useful for integrating new features or bug fixes into your main development branch.


git rebase

The git rebase command is used to apply changes from one branch to another. It is a powerful command because it allows you to update your branch with changes from another branch while keeping your branch history clean and easy to follow. This can be useful for keeping your code up-to-date with the latest changes made by other developers.


git reset

The git reset command is used to reset your branch to a previous commit. It is a powerful command because it allows you to undo changes that you have made to your branch. This can be useful for fixing mistakes or errors in your code.


git stash

The git stash command is used to temporarily save changes that you have made to your branch. It is a powerful command because it allows you to switch between branches without losing your work. This can be useful for working on multiple features or bug fixes at the same time.


In conclusion, Git is a powerful version control system that has many features and commands that can help developers manage their code changes and collaborate with others. The above commands are just a few of the many powerful Git commands that every developer should know. By mastering these commands, you can become a more efficient and effective developer.





Sunday, June 14, 2020

Revoke/Revert Git Commits from Remote or Local Repository || GIT Users must know

Developers use source control management tools like GIT or SVN daily and commits there code frequently(frequent commit is the good practice though) to avoid losing the code.
But there may be a circumstances we tend to commit the changes which is not relevant or wrong commits. In order to overcome this scenario GIT provides the powerful commands to revoke the changes made locally or even pushed to remote.
Lets see the commands to rollback the GIT commits from Local and Remote branches.
Below are the typical GIT commands to perform the GIT commits

#incrementally add the changes to GIT index before commit.
git add <filename> or git add * 

#Commit the added index to local repository
git commit -m "Good developers write meaningful commit messages"

#Logs all the commit logs of the repo
git logs

#List changes or index added on your workspace
git reflog


#Remove files added to index before commit
git rm <filename>

#Undo the Local commits
git reset --soft HEAD^     # Use --soft if you want to keep your changes
git reset --hard HEAD^     # Use --hard if you don't care about keeping the changes you made

So far we had seen the local commits and roll backing the changes, Now if the Changes are pushed to remote repository and undo the changes Lets wee whats needs to be followed.

#You are reverting the changes from the public repository , You should be very careful when executing the below command.. Below command is forcing the old reference as the recent change in the GIT.

git push -f origin last_known_good_commit:branch_name

Diagram depicts the GIT commit to local and remote workflow


Serverless vs. Kubernetes: A Beginner's Guide

Serverless vs. Kubernetes: A Beginner's Guide Trying to decide between serverless and Kubernetes? Here's a simple breakdown: 🔹 Choo...