Install Git
first of all to install git in your system use this link https://git-scm.com/downloads
How to check git is properly installed or not?
so, to do this in your command shell it's Command prompt in windows
type git
if your git is properly installed you will see this kinda text.
valllahh! your git is properly installed.
How to initialize Git ?
Move to the folder you want git in. open git bash (during the installization time it have asked you to add git bash or use command prompt both are okay)
in shell type command git init
this git init command initialize the repositary and this generatea new folder which is hidden
folder name :- .git
>
tip: folders starting with .(dot) are hidden.
how to remove git from project/folder?
in this .git folder all the history is stored. if you want to remove the git from you project just simply remove .git folder
Overview of how git see things
there are 3 areas
- working directory
- stage area
- git directory
we work on working directory (like project ,file, folder are in working directory). then we stage the working directory
staging area is an area before final commit. in staging area you are allowed to add or remove changes .
after staging the file we finally commit them. commit means it is finally saved in git repositary.
How to see what all changes did you make?
git status
this command show all the changes done recently before commit.
in this example , red color text is showing the changed file.
How to stage the changes
git add .
or git add file_name
command is used to stage the file.
git add .
:- .(dot) in this shows that stage new or modified file in directory.
git add filename
:- at the place of filename type the file name you want to stage.
this command stage that pariticular .
How to commit the changes.
git commit -m "message"
this command is used to commit the changes
here -m is for writing a message
How to see all the commits
git log
command is used to see all the commits.