Git_ShotNotes
Git_ShotNotes
----
Version Control system is a tools that helps to track changes in code.
git is a version Control system.is is:
popular
free & Open Source
fast & scalable
Work done by git:
------------------
Github:
-------
Website that allows developers to store and manage their code using git.
https://github.com
We upload our code in the form of folder.Which is known as Repository(Repo).
Now create an new repository with any name and you have also an option to give
decription and you can control who can see your repo and we can also add README.md
file that contains the metadata of the project.
Commits are the basically Changes, that make sure that the any change that is
being done is now confirmed and it is now being saved and its screen shot has been
taken.
Every time when we make any change in our project we have to commit that changes to
reflect in the git repository.
Set-up git:
-----------
It is a version control tool that is must be installed in your system and we
can download the git from its official website to work with git we need to also
gitBash from the website.
Configuring Git:
---------------
After installation and setup of git now firstly we need to do the config the
git meaning of config the git that are telling to the git that in which account we
are going to make the changes.
git config --global user.name "GitHub-User_Name" //Github user anme.
git config --global user.email "rinku5060saini@gmail.com"
clone:-
-------
Cloning a repository on our local machine means we can create a duplicate
repository using the clone command.i.e if we want to want to any github repo to
download or copy in our pc/Laptop or machine that we can make a copy of that repo
using this command.
git status
On branch main
Your branch is up to date with 'origin/main'.
Now suppose we create a file index.html in the same repo locally the reflect that
file on github account we also need to follow some steps:-
check status again:
-------------------
On branch main
Your branch is up to date with 'origin/main'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
index.html
no changes added to commit (use "git add" and/or "git commit -a")
no changes added to commit (use "git add" and/or "git commit -a")
The above status will be show.That file will be Untracked file for github.
Types of status:
----------------
There are following four types of status:-
1.untracked:
------------
New files that git does't yet track.
2.modified:
-----------
changed the file and not updated yet
3.staged:
---------
file is ready to be committed.After being addded the file become staged.a
4.unmodified:
-------------
unchanged.When we make commit then they become unchanged.
This will make the file stage means after using the command add our file will be
ready to be commited.
now status:
----------
On branch main
Your branch is up to date with 'origin/main'.
git add . is used when we have more then one file to be added.
now status:
-----------
On branch main
Your branch is up to date with 'origin/main'.
2.commit:
---------
It is the record of changes.
3.push:
-------
push upload local repo/file content to remote repo.Basically we use push
command to send the changes(files) from local to remote.
Now the all changes including file will reflect on the github account.
origin:
-------
This the name/link of repo.
-----------------------------------------------------------------------------------
--------
Now we will talk about how to upload the entire code from our machine to github
using git.
First we will create a new folder and one that folder into cmd and write command
git init.
Now the repo will reflect remotely now if we make any changes or create new files
in that repo now we have to follow the above steps till the commit after that will
follow the following steps:-
Pull Command:
-------------
git pull origin main
used to fetch and download content from a remote repo and immeditaly update the
local repo to match that content.