Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • commiting a first file using git

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 498
    Comment on it

    As we have initialize here our first project we are now ready to make our first commit.

    Check the status

    naveen@naveen:/var/www/html/RND/symfony_sites/symfony_todoapp$ git status

    Git will show the message

    On branch master
    
    Initial commit
    
    nothing to commit (create/copy files and use "git add" to track)
    

    So,Now I goona create a new file and save it in project directory, I have used gedit to create a file, you can use any text editor of your choice.

    I have created a txt file name it `my_first_file` and saved it under `/var/www/html/RND/symfony_sites/symfony_todoapp/` now my file locaiton is `/var/www/html/RND/symfony_sites/symfony_todoapp/my_first_file`

    On Terminal: Now tell Git to add all changes that have been mabde to this entire project

     naveen@naveen:/var/www/html/RND/symfony_sites/symfony_todoapp$ git add . 

    dot indicate this directory

    naveen@naveen:/var/www/html/RND/symfony_sites/symfony_todoapp$ git status

    Now Git will display this message

    On branch master
    
    Initial commit
    
    Changes to be committed:
      (use "git rm --cached ..." to unstage)
    
        new file:   my_first_file
    

    Git now found that the file has been added but still this file is not commited

    Now I am going to commit it tell Git to put it in permanent memory, to put it in the repository. with a message -m so that I can know in future what changes I have made at this point. it is always a good idea to put something more specific in message.

     naveen@naveen:/var/www/html/RND/symfony_sites/symfony_todoapp$ git commit -m "my initial commit" 

    Now Git will show you a message

    [master (root-commit) a67edfa] my initial commit
     Committer: Naveen 
    Your name and email address were configured automatically based
    on your username and hostname. Please check that they are accurate.
    You can suppress this message by setting them explicitly:
    
        git config --global user.name "Your Name"
        git config --global user.email you@example.com
    
    After doing this, you may fix the identity used for this commit with:
    
        git commit --amend --reset-author
    
     1 file changed, 1 insertion(+)
     create mode 100644 my_first_file
    

    we will be learning more on how to confgure global user.name and global user.email and many other global setting of config file later

    Below is the basic flow of git

    • make changes
    • add the changes
    • commit the changes

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: