Learn Git And Github - In Very Easy Way [Codex-2]

     

Ok Welcome Back To TraxDinosaur,

So In Last Codex We Created A Git Repository Using git init Command.

So Now Lets Start..

Use git status command and see what it saying.

if you have already some files in your folder (Which Is Now A Repository)
Then It Will Show That Files Name As A Untracked Files And If You Have Nothing In Repo Then It Will Say You That Evrything Is Clear..


Now What Is Untracked Files??

Lets Understand It.

As GIT Is Not A Human And Also Not An AI. So GIT Cant Get It What Are You Doing.

So You Have To Tell It Everything.

Whenever You Will Create A New File In Your Repo Then You Have To Add In Git's Mind.

Untracked Meaning GIT Dont Know About That File.

So We Have To Add It In Git Using git add Command.

Like It I Created One File Named Trax.txt And Dinosaur.txt

Example: git add trax.txt
                git add Dinosaur.txt

Or We Can Also Add All Files Using

                git add .
                git add --a
                git add -A


(When We Create A New Init And In That Folder Files Already Exist Or After Init You Create New File Then Git Doesnt Know About Files That What Is In It So We Have To Add That Files In Git Using git add Command[in a rough way])


Now After Add That Files In Git If You Check Their Status Then It Will Show Unchanged.
And You Can Also Know It  Why ??

Because Since We Added That Files In Git We Relly Didnt Edited That Files So It Will Show Unchnaged.
But If You Will Chnage That Files After Adding In Git. Then It Will Show Its Status As A Modified
Get It Why??(Because You Really Modified That File.)

Now After Editing That File When Git Status Show It Modified That You Have To Again Add It So It Will Again Go To Status Of Unchanged .

(When We Modify File Then Git Will Show Status Of Modified Now To Add That Changes What We Created We Have To Add Again That File Using git add Command[You Can Add One Or Multiple FIles Also])

(And When You Add Changes Then That File Will Be Showing Unchanged Because Git Saved Our Changes. Got It?)

So Now After Adding Our File Still Not Fully Saved To Save Our File Fully In Unchanged Mode Then
We Have To Inform Git That We Created This Chnages Chnages Now I Wanna Fully Save This File.

And To Do This Use git commit Command.

Example: git commit -m "Added Some Italic Lines To Look Cool"
                -m = Message
                 As A Good Human Being We Tell Our Self And Who Will Watch Our Created Repo
                 We Should Inform That What Changes We Created In File.

And When You Will Commit File And Then Then Check git status Then You Will Get All Clear.

Why?? Because All Chnages We Created In File All Are Saved. So All Thing Is Clear.
Now When You Again Update Files Then This Same Thing You Have To Do.



See You In Next Post [Codex-3]
By @TraxDinosaur


Post a Comment

0 Comments