What
is Git ?
Git is a version control system.
Version control system is a system which
allows developers to work together. In a version control system the developers
can do the implementations simultaneously without overwriting each other’s changes.
There are two types of version control systems called Centralized Version Control
System and Distributed Version Control System.
In Centralized Version Control System uses a
central server. This server enables to store all files and all the developers
work with this central server. But the worst case is the single point of failure.
In distributed version control system’s this
worst case scenario does not exists because if any failure is occurred in the
server then the repository from any client can be copied back to the server to
resolve the failure.
Git belongs to Distributed Version Control
System type.
Terminology
in Git
- Working directory - This is used to do the all modification and then you can commit them in to your local repository .
- Commit – Commit holds the current status of the repository
- Branch – When we need to add a new feature to the project then we create a new branch and do that modification within that branch. After the all modifications we can merge the branch to the master branch and delete the temporary created branch. Where master branch means the default branch.
- Clone – Create a local repository from the git repository
- Pull – Copy changes from remote repository to local repository.
- Push - This is used to store all the changes permanently in git repository.
How to Make a pull request?
> git clone
<HTTP clone URL>
The following figure shows the HTTP clone
URL.
Go inside the cloned directory from command prompt and enter the following command.
>git remote - v.
The above command shows the origin.
Create an upstream.
>git remote add
upstream <HTTP clone URL of parent repository>
Default you have a master branch. But if we
do the modifications we need to create a new branch to do the modifications.
Create a new branch using the following git
command
> git checkout -b
<name for the branch>
Now manually do your changes in to your local
repository.
To view the all modified files/directories use
the following git command.
>git status
Now you can see the modified files in red color
in command prompt as shown in below figure.
The modifications that you made can view using the following git command.
>git diff
You can view all the modification as shown
below.
Add those modification to the relevant files using the following git command.
>git add <Path
of the modification file/directory>
Then you can view the successfully added
modifications in green color as shown below.
Commit the changes in to local repository.
>git commit
Push the all modifications to git repository using
following git command. This will add the all the changes to your git
repository.
>git push origin
<branch name you are in>
Then go to your git repository and then you
can see a button called “Create pull request” .
Go down and then you can see the modified
files. Again check whether the modifications are correct or not.
Click on “Create Pull Request”.
[1].https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
Well explained ;)
ReplyDelete