Pedro's blog: db2, mysql, php, linux and performance


how do I use git everyday
01/11/2014, 8:15
Filed under: General,Programming | Tags: , , , , ,

From the Giovani Collazo we get a git quick reference tip on how to use git everyday:

 

how to use git everydayEveryday I use git on a local repository were I am working alone, under this scene there is no problem with overwritten others changes or using outdated code but, what if I am working with a repository were other coders are working too?

Here it comes the recipe:

  • Checkout the master branch and pull of the most recent changes:

    $git checkout master
    $git pull

  • Create a new branch to work on the new changes

    $git branch my-new-cool-branch
    $git checkout my-new-cool-branch

  • Do your changes and afterwards you add and commit them

    $git status
    $git add .
    $git commit -a -m ‘Bug fix #1782 and new method getFullDescription’

  • Now is when the magic comes, we are going to rebase with the master branch and then merge it

    $git checkout master
    $git pull
    $git checkout my-new-cool-branch
    $git rebase master

    If there is any conflict it will appear now! solve it in your branch and try again.

  • The last step is to checkout with the master and merge our branch

    $git checkout master
    $git merge my-new-cool-branch

  • Right now everything is fine so we can send our changes to github

    $git push

The source of the recipe is in spanish here:  http://elweb.co/como-uso-git-todos-los-dias/

Do you want to learn more about git? take a look to the entire Pro Git book, written by Scott Chacon and Ben Straub http://git-scm.com/book




No Comments so far
Leave a comment



Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



¡IMPORTANTE! Responde a la pregunta: ¿Cuál es el valor de 7 8 ?