Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Git Basic WorkFlow

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 536
    Comment on it
    Previous Git Blogs


    Intialize git repostiory
    First Commit
    Two tree architecture and Three tree architecture
    Best basic practices for writing commit messages
    Viewing the commit logs

    To keep things simple I am using only one file

    We got a three tree 1. repository 2. staging index 3. working

    now we add/create a file to the working directory say it test.txt and we call this set of changes A its a simple reference for the changes. What happen here

    1. repository
    2. staging index 
    3. `A`  working [test.txt] (v1)
    

    When we do

     git add test.txt 
    what it does it pushes the test.php to staging index and now the changes are also available in staging index as well.

    1. repository
    2. `A`  staging index [test.txt] (v1)
    3. working [test.txt] (v1)
    

    Now When we do

     git commit 
    it takes all changes from the staging index and push it to the repository. Now changes are available in the repository permanently,it's tracked, and it has a commit message about the change we have made.

    1. `A`  repository [test.txt] (v1)
    2. staging index [test.txt] (v1)
    3. working [test.txt] (v1)
    
    Ok now we make the change in working directory
    1. `A`  repository [test.txt] (v1)
    2. staging index [test.txt] (v1)
    3. `B`working [test.txt] (v1) /*B is the change*/
    

    Once we saved it we will have the version 2 of the file

    1. `A`  repository [test.txt] (v1)
    2. staging index [test.txt] (v1)
    3. `B`working [test.txt] (v2) /*B is the change*/
    

    Now We stage our changes

     git add test.txt
    changes we would have.

    1. `A`  repository [test.txt] (v1)
    2. `B`staging index [test.txt] (v2) /*B is the change*/
    3. working [test.txt] (v2)
    

    and finally we have all together we will commit

    git commit
    1. `A`   `B` repository [test.txt] (v2) /*B is the change*/
    2. staging index [test.txt] (v2) 
    3. working [test.txt] (v2)
    

    Now version 2 of the file exist in repository.

    Be careful don't mistakenly think that A and B refer to a single file. In example I am using a single file, `A` `B` are the changed sets, sets of changes.

    Thanks

 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: