Featured Post

15 Python Tips : How to Write Code Effectively

Image
 Here are some Python tips to keep in mind that will help you write clean, efficient, and bug-free code.     Python Tips for Effective Coding 1. Code Readability and PEP 8  Always aim for clean and readable code by following PEP 8 guidelines.  Use meaningful variable names, avoid excessively long lines (stick to 79 characters), and organize imports properly. 2. Use List Comprehensions List comprehensions are concise and often faster than regular for-loops. Example: squares = [x**2 for x in range(10)] instead of creating an empty list and appending each square value. 3. Take Advantage of Python’s Built-in Libraries  Libraries like itertools, collections, math, and datetime provide powerful functions and data structures that can simplify your code.   For example, collections.Counter can quickly count elements in a list, and itertools.chain can flatten nested lists. 4. Use enumerate Instead of Range     When you need both the index and the value in a loop, enumerate is a more Pyth

The Real Use of Git in DevOps Environment

Why you need Git? Here's well explained with differences among Git, GitFlow and GitHub.

Git is a tool


Git in devops



It is created by Linus Torvalds, the creator of the Linux system. The tool was created to help Linux developers control the development flow among many developers around the world. It helps to solve conflicts, track the modifications, or even revert the configurations that were working before and stopped working in a new version.


To install Git, you can access the following link: https://git-scm.com/download/win


The installation process is the same as we did for all Windows applications; it is just Next, Next, and Finish.

After the installation, you will find a new program called Git Bash, which allows you to create your local repos and use the Git commands to create versions of your application.


GitFlow


Now, when we start working on a project, we have the code files that are already in production, and we cannot work in the main branch, because of the CI/CD pipelines. We need to generate a new version of our software with the complete code.

Let's commit the first version of the code, which will be shared among all the developers working on the same project: PS

C:\Users\1511 MXTI\Chapter09> git add --all PS C:\Users\1511 MXTI\Chapter09> git commit -m "uploading the scaffold of the project" [master (root-commit) f6284bf] uploading the scaffold of the project 1 file changed, 3 insertions(+) create mode 100644 code.txt


If we run the git status again, nothing is untraced or pending to commit: PS C:\Users\1511 MXTI\Chapter09> git status On branch master nothing to commit, working tree clean


To check the branches you have, run the following command: PS C:\Users\1511 MXTI\Chapter09> git branch * master.

GitHub


The commands ran in the local machine and in a local environment. It was just the basic steps, but I am pretty sure that with these commands you will be able to do 80% of your work every day. If you cannot, there are many tools to help you with the Git commands, like git Kraken, or you can even use plugins for Visual Studio Code.

We need to have in mind that as bigger as your team is, you will have more conflicts and more changes happening at the same time.

To share our code, we can use many tools, like GitLab, GitHub, Bitbucket. There are dozens of services to help you with it. Let's use GitHub because it is the most famous. But, for some of my personal projects, I use Bitbucket, because we can have unlimited private repos.


You can create your own GitHub account for free on their website:

https://github.com/

Comments

Popular posts from this blog

How to Fix datetime Import Error in Python Quickly

SQL Query: 3 Methods for Calculating Cumulative SUM

Python placeholder '_' Perfect Way to Use it