GIT 

OR: HOW I Learned to stop worrying and love scm

Best practice Branching model

  • Use master for production-ready code
  • Merging in master is called release
  • Use develop for development of next release
  • Run nightly builds on develop

Main branches


Feature Branch

Development of a single feature

  • Branched off develop
  • Merged in develop

    Feature branch


    Release Branch

    Support finishing of a release (bugfixing!)

    • Branched off develop
    • Merged in develop (=give back the bugfixes)
    • Merged in master (=Release)

    Release Branch


    Hotfix branch

    Used to fix an urgent problem on production


    • Branched off master (release tag)
    • Merged back in develop and master

    Hotfix branch


    Initialize a GIT REPO

    $ git init
    # create files etc.$ git add .$ git commit -m "Initial commit"
    # do something$ git add .$ git commit -m "Something changed"
    # fix some typo in README$ git add README$ git commit -m "Fixed typo"

    Single Branch

    Create another branch

    $ git checkout -b develop


    Create commit on branch

    $ git commit -m "Implementation of XY" 


    Fast-forward "master"

    $ git checkout master$ git merge develop


    Diverging branches (Merge)


    Merge diverging branches

    $ git checkout develop$ git merge feature-X$ git branch -d feature-X

    "I Don't know what I'm Doing" merge

    $ git merge develop$ git checkout develop$ git merge feature-X

    Diverging branches (Rebase)


    Rebase diverging branches

    $ git checkout feature-X$ git rebase develop

    After rebase => Fast-forward

    $ git checkout develop$ git merge feature-X # fast-forward!

    AFTER REBASE => Merge

    $ git checkout develop$ git merge --no-ff feature-X$ git branch -d feature-X

    Rules of thumb

    1. Discuss for each project how to tell your story
    2. Use rebase locally to pimp your history
    3. Use merge to preserve your feature branches
    4. Use tags if you release
    5. Don't get confused by remote branches

    RESOURCES

    Questions

    ?

    Made with Slides.com