Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views17 pages

Version Control System Is A Tools That Helps To Track Changes in Code Gitisa

Uploaded by

gargswyam62
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)
7 views17 pages

Version Control System Is A Tools That Helps To Track Changes in Code Gitisa

Uploaded by

gargswyam62
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
You are on page 1/ 17

Git

Version Control System is a tools that helps to track changes in code


Git is a Version Control System It is :

Popular
1. Track the History
Free & Open Source 2. Collaborate

Fast & scalable


Github

Website that allows developers to store and manage their code using Git.

https://github.com

Folder (Repository)
Github Account

Create a new repository : acpinstitute

Make our first commit

Add Commit

Step 1 Step 2
Setting up Git

Visual Studio Code

Git --version
Configuring Git

git config --global user.name “My Name”

git config --global user.email “[email protected]

git config --list

global local
Clone & Status

Clone – Cloning a repository on our local machine

git clone <- some link ->

Status – Display the state of the code

git status

remote local
Status

untracked
New files that git doesn’t yet track

modified
changed

staged
File is ready to be committed

unmodified
unchanged
Add & Commit

Add – adds new or changed files in your working directory to the Git staging area.
git add <- file name ->

Commit – it is the record of change


git commit –m “some message”
Push Command

push – upload local repo content to remote repo.


git push origin main

or

git push <- repo link ->


Init Command

Init – used to create a new git repo

git init

git remote add origin <- repo link ->

git remote –v (to verify remote)

git branch (to check branch)

git branch –m main (to rename branch)

git push origin main


Branch Command

git branch (to check branch)

git branch –M main (to rename branch)

git checkout <-branch name-> (change branch)

git checkout –b <-new branch name-> (to create branch)

git branch –d <-branch name-> (to delete branch)


Merging Code
Way 1
git diff <-branch name-> (to compare commits, branch, files & more)

git merge <-branch name-> (to merge 2 branches)

Way 1

Create a PR
Pull request

It lets you tell others about changes you’ve pushed to a branch in a repository on
GitHub.
Pull Command

git pull origin main

used to fetch and download content from a remote repo and immediately update
the local repo to match that content.
Resolving Merge Conflicts

An event that takes place when Git is unable to automatically resolve differences
in code between two commits.
Check Commit and hash

git log
Undoing Changes

Case 1 : staged changes

git reset <-file name->


git reset

Case 2 : command changes (for one commit)


git reset HEAD~1

Case 3 : Commited changes (for many commits)


git reset <-commit hash->
git reset –hard <-commit hash->

You might also like