You are on page 1of 37

Why version control

Git and github


What is GIT?
Features of Git
Git status after adding file in git

Git base
Now you can commit changes terminal
Add all multiple files edu1,edu2,edu3 in index
Add all files at a
time

Commit
Git log
How to create branches

Go to git base

Right now we are in master branch


Create a file in first branch
Files in first branch
Going back into master branch

Files in master branch


Merging-means combining the different branches all together

Go to terminal

Master branch

Edu1

Edu2

Edu3

First branch

Edu4

Now to merge edu4 into master branch we need to follow below


List out files in master branch
Note: if the files is already in index and we have modified then no need to add again in index while doing
commit only again it will explicitly added in index.
Modification of edu4 done in first branch but not merged in master branch
Rebasing- it is also one kind of merging

It is used to make the branches in linear fashion.

Process to do rebase
Files in master

Switch to first branch


Rebase
Difference between git pull and git fetch

Git pull- pulls all the new/change files from central repository and directly places them into master
branch.

Git pull=git fetch+ git merge

Git fetch-it also fetches all the change/new files from the central repository but it actually stores in
different branch.
PUSH Changes

Ssh connection url


Add ssh key

To see public ssh key


Go to setting in githhub
Select SSH and GPG keys

Click on new ssh key


Click on add SSH Key
Now we can push the code to central repository
Switch to master branch

Push to master
Staging area is
indexed

You might also like