0% found this document useful (0 votes)
19 views8 pages

Git & GitHub Deep Dive for DevOps

Git is a distributed version control system that allows developers to work collaboratively on projects. It tracks changes to files and allows developers to commit changes locally and push them to a remote repository hosted on services like GitHub. A local Git repository stores project files and history on an individual developer's machine, while a remote repository hosted on GitHub allows collaboration between team members by sharing a central codebase in the cloud. To connect a local repository to a remote one, developers clone the remote repository, make and commit changes locally, then push those changes to the remote repository.

Uploaded by

sheak Imran
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views8 pages

Git & GitHub Deep Dive for DevOps

Git is a distributed version control system that allows developers to work collaboratively on projects. It tracks changes to files and allows developers to commit changes locally and push them to a remote repository hosted on services like GitHub. A local Git repository stores project files and history on an individual developer's machine, while a remote repository hosted on GitHub allows collaboration between team members by sharing a central codebase in the cloud. To connect a local repository to a remote one, developers clone the remote repository, make and commit changes locally, then push those changes to the remote repository.

Uploaded by

sheak Imran
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Day 9 Task: Deep Dive in Git & GitHub for DevOps

Engineers.

1. What is Git and why is it important?


Git is a Devops Tools,is mainly used to source code management.
There are 2 types of the source code management
a) Centralized version control system
b) Distributed version control System
Git is a free and open source Distributed version control System used to
handle small to lage project [Link] is a technology, they allows
developers to work together on a non-linear development. Git also allows
developers to keep the local copy of the remote repository. To make a
change in a local repository, and again push to remote repository for the
latest code is available to others developers.
Git keeps tracks of all your versions,so in any case you can rollback to
previous version ,you easily rolled out by using single commend.
With the VCS ,all the team members are allowed to work freely on any file
at any [Link] gives you the flexibility to merge all the changes into a
common version.
A distributed vcs like git allows all the team members to have a complete
history of the project,so if there isa breakdown in the central server you can
use any of your teammate’s local git repository.
A Web based version is available for git I.e. [Link] is cloud based
platform uses the git technology to maintain distributed version control
systems.

2. What is difference Between Main Branch and Master Branch?


In Git the master branch is a default branch. There main difference between main
and master is only naming convention. GitHub has recently renamed it’s “master”
branch to “main” branch.
Master or main branch is a root branch, In this branch all the changes eventually
get merged back. This is typically the branch where the main development work
takes place and from which other branches are created.

3. Can you explain the difference between Git and GitHub?


GIT:
Git is a technology used to distributed version control system to manage
development project source code history.
Git is DevOps tool ,the developer Installs locally on their computer. It First
Released on 2005 and maintained by Linux foundation.
The Git is mainly focused on version control and code sharing also provides
preliminary command line tools

GITHUB:-
GitHub is a cloud based or web based platform and they uses git technology.
GitHub is a web based service, the developers who use git can connect and
upload and download resources. GitHub first Released on 2008 and maintained by
Microsoft.
GitHub is available on a web and is mainly focused on centralized source
code hosting.

4. How do you create a new repository on GitHub?


Follow below steps to create a new Repository on GitHub:
i. Sign in or create a new account on Github
ii. On the top right corner of the screen, click on (+) symbol and click
“New Repository”

iii. On the next stage, enter a name of your repository, a short


description and select where this repository is available
public(visiable to everyone) or private.

iv. After that, the New Repository will be created.


5. What is difference between local & remote repository? How to connect local
to remote?
Git is Distributed version control system. That’s why you can create or store
repository on local.
Local Repository is a repository that is stored on your computer I.e. each team
members. While Remote Repository is a repository that is stored on separate
machine or server.
One of the main Difference between a local and Remote repository is,
The local repository is accessible only you and your own machine. While the
Remote repository is accessible to everyone over the internet.
This is useful for developers to collaborate on the same codebase.

Follow below steps,to connect local to Remote:-


i. First step is, clone your remote project
git clone <remote url>
ii. After that check the git status and add untracked files to staging
git status
git add .
iii. After that commit the staged changes
git commit –m “Commit Message”

iv. Go to local repository, and first check the available remote URL
git remote -v
v. If no any url are added, then add the remote repository as an origin to
your local using below git command
git remote add origin <remote repository url >
vi. After connect to remote, push the local repository master branch to the
remote repository using
git push –u origin master

If you facing any Authentication issue, please follow below steps


a. Go to Setting
b. Go below and click Developer settings

c. Select personal access tokens and choose tokens(classic).


--------------------Happy Learning ----------------------

Common questions

Powered by AI

Git's ability to maintain a local copy of a remote repository enhances productivity by allowing developers to work offline, experiment, and test changes without immediate network access. This feature provides flexibility in development workflows, reduces dependency on network latency, and allows developers to work independently without affecting the main project until they're ready to push changes .

Git is a distributed version control system designed for tracking changes in source code during software development. It is open source and maintained by the Linux Foundation, primarily focused on version control and code sharing via command line tools . In contrast, GitHub is a web-based platform using Git technology, offering centralized source code hosting, collaboration features, and is maintained by Microsoft. GitHub allows developers to upload, download, and manage repositories centrally in the cloud, providing a layer of cloud-based management that Git alone does not offer .

To create a new repository on GitHub, sign into your account, click the '+' symbol, and select 'New Repository.' Enter the repository name, description, and choose its access level (public or private). Finally, create the repository. Correctly following these steps ensures proper setup, visibility configuration, and availability of the repository for collaborative efforts .

Git facilitates non-linear development by allowing branching and merging, enabling multiple developers to work concurrently on different features or bug fixes without interfering with each other's work. This allows for parallel development, rapid prototyping, and flexible collaboration without long wait times for committing changes, ultimately speeding up development cycles and reducing integration issues .

When setting a GitHub repository as public, it becomes visible and accessible to everyone on the internet, ideal for open-source projects where community contributions are welcome. A private repository restricts access, suitable for proprietary projects or sensitive information. This decision affects who can view and contribute to the codebase, impacting security, project collaboration dynamics, and potential community engagement .

Personal access tokens play a crucial role in resolving authentication issues for pushing to a remote repository by offering a secure method to authenticate users in place of passwords. When traditional password authentication fails due to increased security measures or disabled password authentication, personal access tokens can be generated and used as an alternative, ensuring secure access while adhering to current security protocols .

To connect a local Git repository to a remote repository, first clone the remote project using 'git clone <remote url>.' Check the git status and add files using 'git add .' Commit changes with 'git commit -m "Commit Message".' Next, verify the available remote URL with 'git remote -v' and add the remote repository URL using 'git remote add origin <remote repository url>.' Finally, push changes using 'git push -u origin master.' These steps ensure that local changes are synchronized with the remote repository, facilitating collaboration and ensuring everyone works on the latest code version .

Having a complete project history in Git is crucial as it allows developers to rollback to any previous version of the project if needed, which is essential for undoing erroneous changes or recovering from mistakes. It also aids in merging changes more effectively since the history provides context and lineage of changes, helping resolve conflicts and ensuring the integrity of the codebase .

In a distributed version control system like Git, all team members have a complete history of the project stored locally. This means that if a central server experiences a breakdown, the project's full history and previous versions remain accessible from any team member's local repository, allowing work to continue without relying on the central server .

The transition from 'master' to 'main' branch in Git is significant primarily for reasons of inclusivity and modern naming conventions, as 'master' could imply connotations of hierarchy that some communities wish to avoid. The implications for developers include adjusting workflows and scripts to accommodate the naming change, as well as ensuring smooth transitions and consistency across collaborative projects .

You might also like