DEV Community

Introduction to Git

Quality control is critical, and developers work in small teams using Git for version control.

Introduction to Git
.

What is version control?

  • Version control system (VCS) is a program or set of programs that tracks changes to a collection of files.
  • Another goal is to allow several team members to work on a project, even on the same files, at the same time without affecting each other's work.

  • Another name for a VCS is a software configuration management (SCM) system.

  • To learn more about git and official documentation

With VCS

  • You can see who made the changes and their comments at the time of committing files
  • Retrieve past versions of the entire project
  • Create branches
  • Attach a tag to a version—for example, to mark a new release.

Distributed version control
Earlier instances of VCSes, including CVS, Subversion (SVN) used a centralized server to store a project's history. This centralization meant that the one server was also potentially a single point of failure.

Git is distributed, which means that a project's complete history is stored both on the client and on the server. You can edit files without a network connection, check them in locally, and sync with the server when a connection becomes available.

Git Terminology

  • Repository (repo): The directory, located at the top level of a working tree, where Git keeps all the history and metadata for a project. Repositories are almost always referred to as repos.
  • Commit: When used as a verb, commit means to make a commit object.
  • Branch: A branch is a named series of linked commits. The most recent commit on a branch is called the head. The default branch, which is created when you initialize a repository, is called main, often named master in Git. The head of the current branch is named HEAD.
  • Remote: A remote is a named reference to another Git repository. When you create a repo, Git creates a remote named origin that is the default remote for push and pull operations.

Git Command line : Different GUIs available for Git

  • Git Desktop
  • Visual Studio Code

Differences between Git and GitHub

Git GitHub
Git is a distributed version control system (DVCS) that multiple developers and other contributors can use to work on a project. GitHub is a cloud platform that uses Git as its core technology.GitHub act s as the remote repository

Key features provided by GitHub include:

  • Issues
  • Discussions
  • Pull requests
  • Notifications
  • Labels
  • Actions
  • Forks
  • Projects

Try out - https://learn.microsoft.com/en-us/training/modules/intro-to-git/2-exercise-configure-git

References :

  1. Introduction to GitHub
  2. Getting Started with GitHub

Basic Git commands

  • git status : git status displays the state of the working tree
  • git add : git add is the command you use to tell Git to start keeping track of changes in certain files. You'll use git add to stage changes to prepare for a commit. All changes in files that have been added but not yet committed are stored in the staging area.
  • git command
  • git log : The git log command allows you to see information about previous commits.
  • git help : Each command comes with its own help page, too. You can find these help pages by typing git --help. For example, git commit --help brings up a page that tells you more about the git commit command and how to use it.

References:

💬 If you enjoyed reading this blog post and found it informative, please take a moment to share your thoughts by leaving a review and liking it 😀 and follow me in dev.to , linkedin and buy me a coffee

Top comments (0)