Thursday, 30 October 2014

Need not depend on server database with GIT

if you screw things up or lose files, you can easily recover(revert your whole project to previous version know as a version controll system)


>>>>Git has 3 states
1. Committed :- saved to database
2.modified:- changed but not saved to database
3.stagged:- marked for modified and switched to new work.

some file permission logic in unix:-

there are three commands 
read is for r with value 4
write is for w value 2
execute for e  value 1

>>>>permission to a file is given by chmod permission filename.
 eg. chmod 644 file means 

6=4+2= -rw (you)
4 = -r (your group)
4 = -r (all )

so giving read access to all and your group but write access only to yourself.

so final syntax will be

 chmod (-you-group-all) file-name

where d stands for a directory or if not found is file which we can see using ll command about all files and its file permission. >>>> back to git
 if you want to track a existing project in git, you go to that project directory and type

$ git init \\ this will create a new sub directory as .git which contain all necessary repositories files.

COPYING AN EXISTING REPOSITORIES

1. $ git clone url 

2.to checkout a branch

 $ git checkout <existing-branch>

3.to create a new branch 

$ git checkout <new-branch>

4.

 $ git checkout -b <new-branch> <existing-branch>
    this will run the <new-branch> before.

>>what is a git snapshot????
 its a current content of test branch.

.>> What is a metadata???
 data that describes and give info about other data
e.g:- author, date created and date modified and file size are examples of very basic document metadata.

>>>> each file in working a working directory has two states as tracked and untracked.when will clone a repositories it will be tracked and unmodified as we just now checked them out .

tracked ----------- files in git snapshot which can  be modified , unmodified , staged.
files other that it is called untracked.

Untracked basically means
that Git sees a file you didn’t have in the previous snapshot (commit); Git won’t
start including it in your commit snapshots until you explicitly tell it to do so




 the cycle of modify->stage->commit all which were staged->modify keeps running.



5.use $ git status to determine which files are in which state



6. $ echo 'My Project' > README

    $ git status
  // its untracked
7.$ git add README // readme added to git
    $ git status // your project is now  tracked and staged to be committed.
it’s staged because it’s under the “Changes to be committed

8.after $ git init 
  type $ ls -al to see the .git in your working directory.
9. git-commit - Record changes to the repository
10.An important concept here is that Git has an 'index'

11. to set your username and email adderess
   $ git config user.email your@xxxx.com
 $ git config user.name  yourname

1 comment:

hi provide your opinions here