What is Git? A Beginner's Guide to Git Version Control

Git is a version control system that developers use all over the world. It helps you track different versions of your code and collaborate with other developers.

If you are working on a project over time, you may want to keep track of which changes were made, by whom, and when those changes were made. This becomes increasingly important if you end up having a bug in your code! Git can help you with this.

But Git can also be a bit scary and confusing when you first start learning it, so in this article I will introduce Git in a humanly understandable way. We’ll cover topics such as repositories, commits, branches and much more, so let’s get started!

Here’s what we’ll go over in this article:

  • What is Git?
  • What is GitHub?
  • How to get started using Git
  • How does Git track changes?
  • A typical Git workflow
  • Online course to learn Git version control




#git #github #developer #programming

What is GEEK

Buddha Community

What is Git? A Beginner's Guide to Git Version Control
Lenora  Hauck

Lenora Hauck

1593583680

How To Install Git on Ubuntu 16.04 LTS

Git is one of the most popular tools used as a distributed version control system (VCS). Git is commonly used for source code management (SCM) and has become more used than old VCS systems like SVN. In this article, we’ll show you how to install Git on your Ubuntu 16.04 dedicated server.

Installing Git on Ubuntu 16.04 LTS

We have also created a convenient video tutorial that outlines how to install Git on a Ubuntu 16.04 Server.

Now, let’s get started on that install…

Preflight Check

  • You should be running a server with any VPS Ubuntu LTS release.
  • You will need to log in to SSH via the root user.

First, as always, we should start out by running general OS and package updates. On Ubuntu we’ll do this by running:

apt-get update

After you have run the general updates on the server you can get started with installing Git.

  1. Install Git

  2. apt-get install git-core

  3. You may be asked to confirm the download and installation; simply enter y to confirm. It’s that simple, Git should be installed and ready to use!

  4. Confirm Git the installation

  5. With the main installation done, first check to ensure the executable file is set up and accessible. The best way to do this is simply to run Git with the version command.

  6. git --version

  7. git version 2.7.4

  8. Configure Git’s settings (for the root user)

  9. It’s a good idea to setup your user for git now, to prevent any commit errors later. We’ll setup the user testuser with the e-mail address testuser@example.com.

  10. git config --global user.name "testuser" git config --global user.email "testuser@example.com"

Note:

It’s important to know that git configs work on a user by user basis. For example, if you have a ‘david’ Linux user and they will be working with git then David should run the same commands from his user account. By doing this the commits made by the ‘david’ Linux user will be done under his details in Git.

#distributed version control #git #linux #scm #source code management #tools #ubuntu #ubuntu 16.04 #vcs #version control #version control system

Monty  Boehm

Monty Boehm

1617428820

How To Delete Files or Folders From Remote Git Repository

GIT is great, it has made collaboration with other developers so easy, I can’t thank GIT enough. But GIT is vast and not every command remains on my mind. I find myself googling over and over again to get that right GIT command that can solve my problem.

Recently when working on one of the projects that had just started, I accidentally pushed the IDE folder to the remote repository and I was there googling again, so I thought, why not write a blog for this? I can always come straight to my blog if this happens again and I can also help my fellow developers this way, right?

All sensitive information and IDE related folders should be added to gitignore so they are not tracked by git. You may already know this, but it doesn’t help if your file or folder is already in the remote repository. Today we will learn how we can remove files or folders from remote repositories. Let’s get started!

#git #github #gitlab #git-tags #git-basics #tutorial #guide #version-control

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

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

Git Rebase vs Pull and feature

We face situations daily where we have to choose between pull and rebase to update the local code with the origin. We will see the difference using an example.

Let’s say we have a master branch and it has only one file** Demo.txt.**

We add m1 to it and commit it. Later add m2 and commit it and finally add m3 and commit it.

master

Demo.txt

m1
m2
m3

git log

commit 1c5cff83d7fdf0d857a57e84b0f363b422604800 (HEAD -> master, origin/master)
Author: xyx  <xyx@gmail.com>
Date:   Tue Jul 7 14:23:25 2020 +0530

    m3

commit d1d033fee4dcc9252c57368aa74497d32cebda34
Author: xyx <xyx@gmail.com>
Date:   Tue Jul 7 14:22:28 2020 +0530

    m2

commit ba9bce8ffff7e6dadf81597a063df677a87d6eaf
Author: xyx <xyx@gmail.com>
Date:   Tue Jul 7 14:20:47 2020 +0530

    m1

Now we checkout feature branch from master and add new feature f1 and commit it. Then we add f2 and commit it.

#github ##git ##pull ##pull vs rebase ##rebase ##version control ##version-control