Thursday, February 10, 2022

Getting Started with Git | Git Command

 Git Commands

In this artical/blog i will explain you all the basic commands of Git

To check Version of Git  write the command :- git --version


So it means git is successfully installed in our system.

So now we will run some commands and the first command will be will run is :-

git config --global user.name "NitinPrajapati"


By this on the system it has registered or stored this gate username so it will not ask you the username always when you are doing a commit and push 

So we can just configure all this one time.

Now if you run the same command without the username it should show you the username that is added   

git config --global user.name


Now similarly the next command that we will use in we will say is we will say 

git config --global user.email "prajapatinitin393@gmail.com"

So here i'm just giving my email that i have used for creating an gitlab 


And again if you run the command without giving the Email it should show you the email

git config --global user.email


Now our next step will be create a demo project or a folder and then we will add to git

Now i am going to use some commands to create folders first of all i want to create a folder or directory in my desktop

cd desktop

Now for creating folder or directories

mkdir Gitlab\OurFirstProject


As you can see our folder is successfully created here 


And now here is the trick if you go to address bar and simply type cmd it will directly open this file location in your command prompt



This will save you a little bit of time .

You can also do this thing manually by using the change directory command

Here is the Tutorial video which is based upon GitLab👇👇




Now here i want to initialize git in this folder :- git init

this is the command to initialize git


As you can see it says initialized empty git repository in this location


As you can see here one hidden folder , see this hidden file , in your folder you have to enable view for hidden file

Now the next command we will use is :- git status

So this will show you 

you are branch master and there are no commits yet

So we do not have any change or any files to commit

Now

I am going to create a new text file here in our folder

So for creating a file:- cd>Readme.txt


Now

Again if I do “Git Status”

Now you can see

It says “This is Untracked file “Readme.txt””


So now

We have to add this file :- git add Readme.txt

Suppose we have lots of file here and we want to add that untracked file

So for that :- git add .

This will add all the Untracked file , Now If I again write:- git status


As you can see now its showing in green that means it’s now ready to be committed 

Now we have to commit our changes so

For that

Command is :- git commit -m "my first commit"


you can see This commit is now done.

but If you go to your GitLab account and in your repository or project

You can’t see any changes there because we have just commit our changes

We have not yet push the changes or we have not yet edit anything in our repository

So For that

We have to use a command :- git push -u origin master or in place of origin you can use the url of yodur repository

So I am going to add URL of my repository 

Now if i press Enter this is asking me for my Git Credential

We have to provide our username and password

It maybe for the first time

Now As you can see it’s 100% done

And everything is done 


Now if you go to your Repository on GitLab

You should see your changes here


The changes are here

If I see here this is “Readme.txt” file here

It shows my first commit

which was done two minutes ago.



So this how you can use Git and commit push and pull changes to GitLab

we will also see more commands in the future and in the coming Artical/Blog we will see more on forking project 

creating branches and many other things 

So I hope this all was very useful for you and hope you enjoyed to read this Artical/blog .

If you have any doubts or any questions

please write them down in the comment section below and

I will try to answer you as soon as I can.

▬▬▬▬▬▬ Connect with me    ▬▬▬▬▬▬ 

Youtube Subscription      ►   https://bit.ly/2LENtS1

Facebook Page:               ► https://www.facebook.com/EasyAWSLearn/

Medium:                          ►  https://techworldwithvijaypatel.mediu...

Dev:                                 ►  https://dev.to/easyawslearn

Telegram Channel:                ►   https://t.me/devtul

 













1 comment:


  1. This was the type of article that enlightened me the entire time, and I appreciate it. This is going to be exciting and enjoyable to read. It's because of it. Check it out if you're looking for something a little more thrilling. visit us 

    ReplyDelete

Wireless Security Configuration: Protect Your Network Now!

Introduction: In today’s connected world, wireless networks are as common as smartphones, and they’re often the gateway to our personal, pr...