Git and Github Tutorial - Start With GIT - Part 3

Hi, Today in iThePro we will learn how to use Git and how to use with Github to build software and develop it. In this part we will see how to get started with Git.

Initializing a repository:
We going to tell Git to Initializing a project.

git init
-Now Git will start look at the current directory and track change from now on.
-In this Directory, it seems to look empty but after Initialize there is a hidden folder called ".git". this is the place where git store all his own information and the project configuration.

Git Status:
git status
This Command will show the working tree status. In order to see the status of git in the project.

First Commit:
It's to tell git to track the first Change.
git add .
This Command will tell Git to add All Changes being made to this directory, and put the in the staging index.
git commit -m "Initial Commit"
This Command will tell Git to commit the Change to the repository, with a message .
Note :  if you want to skip adding and directly commit changes, you can use this command:
git commit -am "Message"
Our Steps We Made:
1)Make Changes to the Project.
2)Add Changes to the Staging index.
3)Commit Changes to the repository. 

Writing Commit Messages:
In order to commit changes, we really want a clear message so other people can see and understand clearly. So he's some basic tips you want take a look.

-Short Single-ligne (<50 Char).
-Write Commit Message in present tense
-You can add Ticket Tracking Number From Bugs Or Support Requests.
-Be clear and descriptive as mush as you can.

-"[css,js]" means you're messing with.
-"BugFix :" means fixing bug or Error.
-"#38405 :" means Ticket Number.

Viewing The Commit log:
git log
This Command will show us all the commit log have taken so far.
Each one commit has some basic parts to it:
1-Commit follow by ID and it's a unique ID.
-Author of this commit.
-Date of the commit.
-Message of the commit.

git log -n 1
This will limit the number of commit shows on.
git log --since=YYYY-MM-DD
This will limit the commit since the specific date.
git log --author="Name"
This will limit the commit based on the author name.
git log --grep="Name"
This will limit the commit based on global regular expression search.

Demonstration Video

See the Git and Github Tutorials.




Oussama Amri 21 years, security professional from Tunisia. Lover of computer science especially programming and secuirty. Follow me On :

Popular Posts Powered by Blogger.