Git
Git
BY: Manoj
GIT
Commonly used version control system(going back to older version if new version
as bug)
Tracks the changes you make to files, so you have a record of what has been done.
You can also use online hosts (such as GitHub or Bitbucket) to store a copy of the files and their
revision history.
Having a centrally located place where you can upload your changes and download changes
from others, enable you to collaborate more easily with other developers.
Git can automatically merge the changes, so two people can even work on different parts of the
same file and later merge those changes without losing each other’s work!
Git is used for
Coding collaboration
What does git do?
Manage projects with Repositories
Branch and Merge to allow for work on different parts and versions of a project
Work Together: It lets multiple people work on the same project at the same time without
messing up each other's work.
Backup Your Code: Git stores your code history, so you can always go back to a previous
version if something goes wrong.
Safe and Secure: It's designed to keep your code safe from unauthorized access or accidental
changes.
Free and Open: Git is free to use and open to everyone, with a big community of users and
helpers.
Compatibility: You can use Git on different computer systems like Windows, macOS, and
Linux.
Saves Time: Git's features like branching and merging help teams work more efficiently and
avoid conflicts in their code.
GITHUB
GitHub is an online software development platform. It's used for storing,
tracking, and collaborating on software projects.
2. Work Together: If many people want to help with a project, they can all work on
3. Fix Mistakes: If someone makes a mistake in the code, others can check it,
5. Test Automatically: It can automatically test if the code is working correctly, which saves time
and avoids errors.
6. Share Your Work: If you create a website or something similar, you can show it to the world on
GitHub for free.
In short, GitHub is a helpful tool for programmers to work on code together, keep track of changes, and
make sure everything works smoothly.
Git repositories
Contains all of the project files and the entire revision history
Branches & Merging
1. Let’s say you need to work on a new feature for a website.
3. You haven’t finished your new feature, but you get a request to make a rush change that needs
to go live on the site today.
4. You switch back to the master branch, make the change, and push it live.
5. Then you can switch back to your new feature branch and finish your work.
6. When you’re done, you merge the new feature branch into the master branch and both the new
feature and rush change are kept!
Git commands when working with local repositories
git init:
git commit:
git branch:Determines the branch of the local repository and allows you to add or delete a
branch.
git merge: The merge command allows us to integrate two or more branches together. It
combines the changes made in the branches.
Git commands when working with remote
repositories
git remote: This Git command allows you to connect a remote repository to a
local repository.
git pull: copies the changes made to a project to the local repository from the
remote one.
git push: Copies the changes made to a project to the remote repository from
the local one..
git clone:
We can use the clone command to create a local copy of an already existing remote
repository.
This allows us to copy and download the required repository to the system.
It allows you to build a local directory, consisting of all the necessary files and
history of the repository.
Recording changes to the repository
git clone https://github.com/manojmanumr13/Assignment-UI.git
If i added any file in git web, if I need to pull into my local we can use git pull
If I want to change the branch from master to main
Git branch –M main
We can use
Git commit –a –m “fghjhbj”
Delete branch
git push origin --delete branchname