Git Workshop - 1

Conducted By - Chintan Patel

What Is Git

Sublime's custom image

Git is a tool used for source code management. It is a version control system used to handle small to very large projects efficiently.

Why We Use Git

Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all be merged into one source.

So regardless of whether you write code that only you will see, or work as part of a team, Git will be useful for you.

Sublime's custom image

Git Features

  • Free and open source

  • Tracks history

  • Scalable

  • Branching

  • Secure

Sublime's custom image

Git Workflow

  • Modify the file
  • Staging
  • Commit

Sublime's custom image

Terminologies

  1. Clone - it allows you to clone the repos available on GitHub.
  2. Pull - It pushes the changes to remote repos
  3. Push - It fetch the changes that are done by other user on remote repo.
  4. Branches - Branch in Git is used to keep your changes until they are ready. You can do your work on a branch while the main branch (master) remains stable. After you are done with your work, you can merge it with the main office.

Sublime's custom image

Installation:-

For Mac

Goto link - https://brew.sh/

Copy the available link and paste it in terminal and execute

After execution use command “brew install git”

Check if you have successfully installed git or not by using git –version

For Windows

Goto Link- https://git-scm.com/download/win

When you've successfully started the installer, you should see the Git Setup wizard screen.

Follow the Next and Finish prompts to complete the installation.The default options are pretty sensible for most users.

Open Git Bash, and check if you have successfully installed git or not by using git --version.

Commands

git init - To initialize a repository.

git add - to save the project to the staging area

git commit - saves the snapshot of the project the main branch

git checkout - to change the branch

git branch “branch name” - to create new branch

git reset “ID” --hard - to reset to a previous commit

git log - to show all the commits

git remote add origin "LINK" - to add GitHub link.

git push origin master - to push changes to remote directories

git pull - to fetch changes from remote repos.

git status - to check current status of repository

git log - lists all the commits which have been made

Sublime's custom image

TO IGNORE A FILE

.gitignore file is use to add file name which are supposed to be ignored

What Is Github

GitHub is a web-based Git or version control repository on the Internet with a hosting service. It offers the distributed version control and source code management (SCM) functionality of Git as well as adding its own new features.

Sublime's custom image

Thank You :)