DEV Community

Jayesh Nalawade
Jayesh Nalawade

Posted on • Originally published at jayeshdevops.hashnode.dev

Git & Github(part-1)

what is Git-

Git is a distributed version control system (VCS) that helps developers track and manage changes to their code over time. It allows multiple developers to work on the same codebase simultaneously and keeps a history of changes, making it easy to revert to previous versions if needed.

Key Features of Git:

  • Version Control: Tracks changes in files, allowing developers to save different versions of code, known as commits.
  • Branching: Enables developers to create isolated branches for new features or bug fixes, keeping the main codebase clean.
  • Merging: Combines changes from different branches, which is essential for collaboration and feature integration.
  • Distributed System: Every developer has a full copy of the codebase, which allows for offline work and reduces reliance on a single server.

What is GitHub?

GitHub is a cloud-based platform that hosts Git repositories, making it easy to share code, collaborate, and manage projects. GitHub provides a web-based interface for working with Git, along with additional features like issue tracking, pull requests, and access controls.

Key Features of GitHub:

  • Remote Repository Hosting: Stores your code in the cloud, accessible from anywhere.
  • Collaboration: Developers can work together on projects, review each other’s code, and manage project tasks.
  • Pull Requests: A feature that allows developers to propose changes, review code, and discuss modifications before merging them into the main codebase.
  • Issues: Built-in bug tracking and task management to help organize and prioritize development work.
  • GitHub Actions: Provides automation for CI/CD workflows directly in GitHub.

Configure Git with Username and Email-

1)$ git config --global user.name "Paul Philips

What it does:

  • Sets your name to "Paul Philips" for all the commits you make in any Git repository on your computer.

Why it’s useful:

  • When you make a commit, Git will associate your name with that commit. This is especially important when you're collaborating with others and want to keep track of who made each change.

Example Scenario: You are working on a project with others, and when you make a change and commit it, your name "Paul Philips" will show up in the commit history.

2)$ git config --global user.email paulphilips@email.com

What it does:

  • Sets your email for all commits, so when you push changes to a repository (e.g., GitHub), your email will be associated with those changes.

Why it’s useful:

  • Your email helps identify you in the commit history, and on platforms like GitHub, it will be used to link your commits to your account.

Example Scenario: When you push code to GitHub, your email (e.g., paulphilips@email.com) will show who made the changes, and it helps you keep track of contributions in a public repository.

3)$ git config --list

What it does:

  • Displays all the Git configuration settings that are currently applied. This includes your user.name, user.email, and any other configurations, like your preferred text editor or merge tool.

Why it’s useful:

  • It lets you check if the user information you've set is correct and if any other Git settings are applied. You can also verify if there are conflicting settings between global and local repositories.

Top comments (0)