Git- Where to start?

Hello everyone! It’s Ray.

As mentioned in my the article I posted last time, Git is kind of an integral tool to coders.
Today I’m going to share the basics of Git.

At the first, let’s create an example folder, it could be my-git-repository.

Le’t go to command line

cd the idea patch you like for this folder

let’s type

mkdir my-git-repository

Now type

cd code/my-git-repository

to get into the folder in command line. Code is the name of my own folder, which is different from yours. Please type your own.

Now we are in the folder as follows:

Let’s make a file here

touch example1.html

And then we add the content below in the file:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>First example</title>
</head>
<body>
<p>This is the first example</p>
</body>
</html>

Now type

git init

And then let’s type and take a look

git status

As image shown above, now we could start to use git’s feature.
Currently the example1 is still untracked. Remember that before we make any commit, sounds like that we have to follow those celebrities before receiving what’s new of them.

Let’s add the file and start to track it

git add example1.html

As image below:

Okay. After tracking, now we are going to make our first commit.
Enter

git commit

as image below:

Supposedly, the new window would pop up as image below:

Now we enter the message for this commit for further better recognising.

Finally enter

:wq

it means save and exit this window

Now let’s type

git status

, and it should look like image above.

Enter

git log

, and you could see a series of number which represents the identify number of this commit.

Please note that the number varies out of the content of commit, so each commit is unique. If your commit number is different from mine, rest-assured that that’s pretty normal.

Now we’ve completed our very first commit, and we will be able to go back to this commit whenever we need in the future.

Okay. Let’s call it a day! I will bring more to you in the following days

Organise database with MySQL group by Import Chinese into Database without garbles

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×