First I will share about using git. When we work on a project for a long time then we need to update our project file in the sharing location. Also when we work in a group then we need to combine our works. Suppose one group member work for the homepage, another work for the contact page, another work for the blog page, then we need to add or merge all of the pages in the project. We can manually do it. But it takes some time.

Again when we work for different location then we need to update the file after work. We can also solve the problem manually but it also takes a time to update it.

By using git we can solve the above problem easily.

So it is important how to use it? We need to download and install git before using it. I am sharing it step by step so one can easily understand it.

Step 01:

You have to download and install git on your PC.

Step 02:

Go to your project file then in mouse right click option click on git bash here.

a command window will open.

Step 03:

For initialization write the below command in the command window.

git init

Step 04:

For checking the status of your project file writes the below command in a command window.

git status

Step 05:

For adding file write the below command in the command window.

git add *   //for adding all file

git add filename /for adding specific file

Step 06:

For commit write the below command in the command window.

git commit -m ‘your comment here’

Step 07:

For add remote origin write the below command in the command window.

git remote add origin your git lab project URL

git remote remove origin //for removing origin

Step 08:

Now you have to push your commit. So you have to write the below command in the command window.

git push origin master //if the master is one

git push -u origin master //if the master is more than one

then check your file in gitlab repository

Step 09:

Sometimes we need to have a copy of our work on another computer. For clone file in different location write the below command in the command window.

git clone your git lab project URL

Step 10:

For getting the latest version of a file writes the below command in the command window.

git pull origin master

You can see this video at a glance


How to change existing git origin url/link

so first the existing git remote url

git remote -v

for update the git remote url we use seturl command

git remote set-url origin https://git-repo/new-repository.git

Useful Tags :