0% found this document useful (0 votes)
48 views9 pages

Git Task

Uploaded by

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

Git Task

Uploaded by

Praneeth MVSP
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Introduction:

Git is a popular version control system. It was created by Linus Torvalds in 2005. It is
designed to make it easier to have multiple versions of a code base, sometimes across multiple
developers or teams

 Git is a DevOps tool used for source code management.


 It is a free and open-source version control system used to handle small to very large
projects efficiently.
 Git is used to tracking changes in the source code, enabling multiple developers to work
together on non-linear development.

Functions of Git
 Manage projects with Repositories
 Clone a project to work on a local copy
 Control and track changes with Staging and Committing
 Branch and Merge to allow for work on different parts and versions of a project
 Pull the latest version of the project to a local copy
 Push local updates to the main project

3-Tree Architecture:
The Git workflow is divided into three states:
 Working directory - Modify files in your working directory
 Staging area (Index) - Stage the files and add snapshots of them to your staging area
 Git directory (Repository) - Perform a commit that stores the snapshots permanently to
your Git directory. Checkout any existing version, makes changes, stage them and
commit.
a. Git Installation
b. Creating a GitHub account
c. Git Commands - Working with Local and Remote Git Repositories

a. Git Installation on Windows:


Step 1: Search for Git download in google. Click on Downloads Git SCM

Step 2:
• Browse to the official Git website: https://git-scm.com/downloads
• Click the download link for Windows and allow the download to complete
Step 3:
• Double click the git-installer to install git on your system by following the instructions.

Step 4:
• Git is installed and Git Bash is in the interface to Git.

• Step 5: Ensure git is installed. Click on Git Bash to start the command interface.
$ git –version //Which displays the installed version of git
b. Creating a Git Hub Account
• Step 1: Browse the website https://github.com and click on Signup

• Step 2: Enter your email address with which you want to access github and also create a
password for the same.

• Step 3: Complete the verification process by selecting the spiral galaxy in the given set of
images.
• Step 4: Complete the account creation by entering the launch code that is sent to your
email address as a part of confirmation.
b. Working with Git Commands: Local Repository
Introduce yourself to Git:
For the first time when you start with Git you need to enter the username and email address with
which the
GitHub account is linked. This is to access the remote repository from your local repository.
• git config --global user. name “USER NAME"
• git config --global user.email USER@MAILID

• mkdir <dirname> Create a new directory for the project


• cd <dirname> Change to that directory
• git init: The git init command is used to create an empty git repository.
• git status: displays the state of the working directory and the staging area
• git add. Or git add filename: is used to add all the new or modified files or a specific file
to the staging area to be committed further.
• git commit -m “message”: captures a snapshot of the project's currently staged changes.
Committed snapshots can be thought of as “safe” versions of a project—Git will never
change them unless you explicitly ask it to.
• git diff is used to show changes between commits, commit, and working tree, etc.
• git log command displays all of the commits in a repository's history. By default, the
command displays each commit's: Secure Hash Algorithm (SHA) author. date.
• git reset is a command that is used to undo local changes to the state of a Git repo.

d. Working with Git Commands: Remote Repository


• Sign-in to your git account at github.com
• Create a new remote repository to store your files from local space.
Use the http link to the remote repository for pushing the files from the local to the remote
repository.
Create files using touch command in Git Bash
Content in Workspace

Move the content of files from workspace to staging

Move the files from Staging to Local repository

Push the local repository contents on the remote repository using command
○ git push
Refresh GitHub to check the uploaded content

You might also like