Git and GitHub Basics

Hello Developer,

Today we will learn the basics of Git and GitHub. If you don’t know about git and gitHub, please read my previous article.

Link: A brief intro about Git and GitHub

The Git tool is used for uploading your project in the GitHub repository, you must configure the git tool with your email and username before use. It confirms that the git is installed on your PC. Today I am going to show step by step how can you configure your git tool easily. So, let’s get started,

Configure Git tool:
Firstly open the git bash by right clicking the empty window and run the following commands:

1.Set email: git config --global user.email “you@example.com

  1. Set username: git config --global user.name “Your Name”

Create your First GitHub Repository:
Go to GgitHub.com and follow the following steps

To learn more please visit this link

#git #github #gitcommand #gittools

What is GEEK

Buddha Community

Git and GitHub Basics
Myriam  Rogahn

Myriam Rogahn

1593435300

Basic Git Commands you need to Master

In this part you will get familiar with some basic Git commands. At the end of this blog you will be able to perform certain task like

  • Set up a folder as a Git repository
  • Perform basic Git operations on your Git repository

These are those commands you must conquer

Basic Git Commands

  • At any location on your computer, create a folder named git-test.
  • Open this git-test folder in your favorite editor.
  • Add a file named index.html to this folder, and add the following HTML code to this file:
<!DOCTYPE html>

<html>
<head></head>
<body>
<h1>Sab Batade Aapko</h1>
</body>
</html>

Initializing the folder as a Git repository

  • Go to the git-test folder in your cmd window/terminal and type the following command at the prompt to initialize the folder as a Git repository:
git init

this command will make a file named .git

#github #git #basic-git-commands #git-commands #git-status

Madyson  Reilly

Madyson Reilly

1604109000

Best Practices for Using Git

Git has become ubiquitous as the preferred version control system (VCS) used by developers. Using Git adds immense value especially for engineering teams where several developers work together since it becomes critical to have a system of integrating everyone’s code reliably.

But with every powerful tool, especially one that involves collaboration with others, it is better to establish conventions to follow lest we shoot ourselves in the foot.

At DeepSource, we’ve put together some guiding principles for our own team that make working with a VCS like Git easier. Here are 5 simple rules you can follow:

1. Make Clean, Single-Purpose Commits

Oftentimes programmers working on something get sidetracked into doing too many things when working on one particular thing — like when you are trying to fix one particular bug and you spot another one, and you can’t resist the urge to fix that as well. And another one. Soon, it snowballs and you end up with so many changes all going together in one commit.

This is problematic, and it is better to keep commits as small and focused as possible for many reasons, including:

  • It makes it easier for other people in the team to look at your change, making code reviews more efficient.
  • If the commit has to be rolled back completely, it’s far easier to do so.
  • It’s straightforward to track these changes with your ticketing system.

Additionally, it helps you mentally parse changes you’ve made using git log.

#open source #git #git basics #git tools #git best practices #git tutorials #git commit

7 Best Practices in GIT for Your Code Quality

There is no doubt that Git plays a significant role in software development. It allows developers to work on the same code base at the same time. Still, developers struggle for code quality. Why? They fail to follow git best practices. In this post, I will explain seven core best practices of Git and a Bonus Section.

1. Atomic Commit

Committing something to Git means that you have changed your code and want to save these changes as a new trusted version.

Version control systems will not limit you in how you commit your code.

  • You can commit 1000 changes in one single commit.
  • Commit all the dll and other dependencies
  • Or you can check in broken code to your repository.

But is it good? Not quite.

Because you are compromising code quality, and it will take more time to review codeSo overall, team productivity will be reduced. The best practice is to make an atomic commit.

When you do an atomic commit, you’re committing only one change. It might be across multiple files, but it’s one single change.

2. Clarity About What You Can (& Can’t) Commit

Many developers make some changes, then commit, then push. And I have seen many repositories with unwanted files like dll, pdf, etc.

You can ask two questions to yourself, before check-in your code into the repository

  1. Are you suppose to check-in all these files?
  2. Are they part of your source code?

You can simply use the .gitignore file to avoid unwanted files in the repository. If you are working on more then one repo, it’s easy to use a global .gitignore file (without adding or pushing). And .gitignore file adds clarity and helps you to keep your code clean. What you can commit, and it will automatically ignore the unwanted files like autogenerated files like .dll and .class, etc.

#git basics #git command #git ignore #git best practices #git tutorial for beginners #git tutorials

Monty  Boehm

Monty Boehm

1620027000

Git vs Github: Difference Between Git and Github

IT is in no way different from any other sector when it comes to naming. You would see some systems being named based on their origin while others are named keeping in mind their features or functionality. Then there are some whose names have nothing in common with their origin, features, or anything else related to them.

It is these inconsistencies in naming conventions that make people confused about what a system is all about, what it does, and what benefits it offers. For instance, there are a lot of people out there who still get puzzled when asked about Git and GitHub and whether or not there is a difference between the two.

The similarity in their names has nothing to do with what they really are. They are two altogether different things. But at the same time, you can say that they still have a thing or two in common. Before we talk about Git and GitHub, let us first shed some light on  version control systems (VCSs) and why are they so important.

What is version control?

In simple terms, version control is nothing but a system that keeps track of the changes made to source code or files. With a version control system, you can look back at the changes made to a particular file, either by you or another person, by accessing the version control database. This system gives you the ability to compare different versions of a file, thus allowing you to stay informed about the changes that have happened over a period of time.

The version control system can be referred to as a database that stores snapshots of different files in a project. These snapshots are taken every time a file is modified. It maintains all the records of the different versions of a file. In addition to comparing different versions of a file, VCSs also allows you to switch between them. VCSs can either be distributed or centralized. Let us see how these two types differ.

Centralized version control systems use a single, centralized server to store all the different versions of a file. Users can access these files by gaining access to this centralized server. Now, there is a disadvantage associated with this type of VCS. If the central server fails to function due to any reason, the entire history stored on its will be gone and no one will be able to recover any version/versions of the lost files.

Distributed version control systems have an edge over their centralized counterparts. These VCSs store file versions in two locations – the centralized server and your local machine. So, the disadvantage that we discussed centralized systems doesn’t exist in distributed systems.

Even if the server undergoes failure, you can retrieve all the different versions of your files from your local machine. Suppose you have a file, which is called VersionControl1. Now you made several changes to this file and saved the changes on each occasion. All the changes that you made to this file will be stored in the VCS, which will have all those versions of this file when you made changes to it.

#full stack development #git vs github #git #github

Loma  Baumbach

Loma Baumbach

1601157360

Mirroring Git Changes From One Server to Another Server

Introduction

Hello all, nowadays most of the development teams using GIT version control, some of you may have a requirement of mirroring your team’s git changes from one server to another Git server. This article will help you to achieve the Git mirroring between one server to another server.

Business Case

I got one assignment wherein there will be 2 Git Servers, development will happen in one Git server and the changes should be synchronized to another Git server at regular intervals. But in my case, the complexity is both the servers are in different restricted network. So I have done the small experiment and it worked. And I am sharing the steps to you all in this article.

The Experiment Performed Using Below 2 GIT Servers

Main GIT Server: Let’s take our main git server is located in our office and can be accessed only in-office network.

**Mirror GIT Server: **The mirror server is located at the vendor/client-side, which can be accessible in a normal internet connection but not with our office network. Since the office proxy will block the outside URL’s.

#devops #git #git and github #git best practices #git cloning #git server