Git Commands Tech
Git Commands Tech
GIT Setup GIT + VS Code GIT Workflow GIT add GIT Commit
GIT Push & Pull GIT Branchs GIT Merge GIT Merge Conflicts
GIT Commands
What is Version Control?
Version control is a system that tracks changes to files over time, allowing
developers to revert to previous versions, collaborate efficiently, and manage
different code versions.
It prevents data loss and ensures smooth teamwork in software development.
With out Git
Your Laptop
Project 1 Folder Project 1 Folder Project 1 Folder
Code Code Code
Code V2 Code V2
Code V3
Code V2 Code V2
Code V3
With Git
Your Laptop
Software Development
Project Management
Tracking Versions
With out GitHub
Code V2 Code V2
Code
G
tc
m
/e
ai
p
l/
Code V2
ap
W
ts
ha
ha
ts
tc
G
W
ap
m
/e
l/
ai
p
ai
l/
/e
ap
m
Code V3
tc
G
ts
ha
ha
ts
W
ap
l/
p
ai
/e
m
tc
G
Your Laptop Frnd 1 Laptop
Code V2 Code V2
Your Laptop
Frnd 1 Laptop
Local Repo Local Repo
Github
What is GitHub?
GitHub is a cloud-based platform that hosts Git repositories, enabling developers to
collaborate, manage code, and track changes efficiently.
Diff between GIT & GitHub
Git:
Git works locally to track the changes in folders and Files. helps in organizing the
code with the help of Branches.
GitHub:
A cloud platform that hosts the local repo online. so that anyone with the repo link
can access the project and contribute changes
GIT Setup
In Local System
GitHub Setup
Git Configuration
GIT
Demo
Git Workflow
Local Staging
Comitted
Files Area Changes
Git Workflow
1. git add --all / git add .
This command will add the files to the staging area
Local Repo
Local Repo
Github
Git Workflow
Local Repo
Latest changes in the
Github branch
Git Branches
Project Project
OR
Page 1 Feature 1
Page 2 Feature 2
Git Branches
Local Repo
Branch 1
Page 1 Code
Branch 2
Page 2 Code
Git Branch Commands
1. git branch – Lists all local branches in the repository.
2. git branch <branch-name> – Creates a new branch with the specified name.
3. git checkout <branch-name> / git switch <branch-name> – Switches to the
specified branch.
4. git checkout -b <branch-name> / git switch -c <branch-name> – Creates and
switches to a new branch.
5. git merge <branch-name> – Merges the specified branch into the current
branch.
6. git branch -d <branch-name> – Deletes a local branch (only if fully merged).
7. git branch -D <branch-name> – Force deletes a local branch.
8. git push origin --delete <branch-name> – Deletes a remote branch.
9. git branch -m <old-name> <new-name> – Renames a branch.
10. git branch -r – Lists remote branche