the Central Coding Style

I love hacking my life style.

Git Royale

Summary

  1. A successful branch management
  2. git-flow
  3. Some problems
  4. Solution
    • -R | --remote option
  5. Conclusion
  6. Do you have any questions?
    • with IRC(#git)
  7. One more thing
    • git now

A successful branch management

branch management

Why git?

  • Subversion is dead.
  • Branching and merging are no longer something to be afraid of

Two main branches

  • Master
    • A production-ready state
  • Develop
    • for the next release

Two main branches

Supporting three topic branches

  • Feature
  • Release
  • Hotfix

Feature branches

branch off merge back
delevelp develop

Feature branches

Release branches

branch off merge back
develop develop and master

Release branches

Hotfix branches

branch off merge back
master develop and master

Hotfix branches

git-flow

Git extensions to provide high-level repository operations for the branching model

https://github.com/nvie/gitflow

$ brew install git-flow

Init

$ git checkout -b develop origin/master
$ git flow init

Feature branches

  • Start feature branch

      $ git flow feature start smartphone-version
    

    This means:

      $ git checkout -b feature/smartphone-version develop
    
  • Finish feature branch

      $ git flow feature finish smartphone-version
    

    This means:

      $ git checkout develop
      $ git merge --no-ff feature/smartphone-version
      $ git branch -d feature/smartphone-version
    

Release branches

  • Start release branch

      $ git flow release start 1.0
    

    This means:

      $ git checkout -b release/1.0 develop
    
  • Finish release branch

      $ git flow release finish 1.0
    

    This means:

      $ git checkout master
      $ git merge --no-ff release/1.0
      $ git tag -a 1.0
      $ git checkout develop
      $ git merge --no-ff release/1.0
      $ git branch -d release/1.0
    

Hotfix branches

  • Start hotfix branch

      $ git flow start 1.1
    

    This means:

      $ git checkout -b hotfix/1.1
    
  • Finish hotfix branch

      $ git flow finish 1.1
    

    This means:

      $ git checkout master
      $ git merge --no-ff hotfix/1.1
      $ git tag -a 1.1
      $ git checkout develop
      $ git merge --no-ff hotfix/1.1
      $ git branch -d hotfix/1.1
    

Some problems

git-flow dose not concern for remote repository. Therefore, you need to sync to remote repository with hands.

Chaos!

Solution

Never give up

Add -R | --remote option

https://github.com/iwata/gitflow

$ brew install https://github.com/iwata/gitflow/raw/master/git-flow.rb

Feature branches

  • Start feature branch

      $ git flow feature start -R smartphone-version2
    

    This means:

      $ git checkout -b feature/smartphone-version2 develop
      $ git push -u origin feature/smartphone-version2
    
  • Finish feature branch

      $ git flow feature finish -R smartphone-version2
    

    This means:

      $ git checkout develop
      $ git merge --no-ff feature/smartphone-version2
      $ git branch -d feature/smartphone-version2
      $ git push origin develop
      $ git push origin :feature/smartphone-version2
    

Release branches

  • Start release branch

      $ git flow release -R start 2.0
    

    This means:

      $ git checkout -b release/2.0 develop
      $ git push -u origin release/2.0
    
  • Finish release branch

      $ git flow release finish -R 2.0
    

    This means:

      $ git checkout master
      $ git merge --no-ff release/2.0
      $ git tag -a 2.0
      $ git checkout develop
      $ git merge --no-ff release/2.0
      $ git branch -d release/2.0
      $ git push origin master
      $ git push origin develop
      $ git push --tags
      $ git push origin :release/2.0
    

Hotfix branches

  • Start hotfix branch

      $ git flow start -R 2.1
    

    This means:

      $ git checkout -b hotfix/2.1
      $ git push -u origin hotfix/2.1
    
  • Finish hotfix branch

      $ git flow finish -R 2.1
    

    This means:

      $ git checkout master
      $ git merge --no-ff hotfix/2.1
      $ git tag -a 2.1
      $ git checkout develop
      $ git merge --no-ff hotfix/2.1
      $ git branch -d hotfix/2.1
      $ git push origin master
      $ git push origin develop
      $ git push --tags
      $ git push origin :hotfix/20111201-1234
    

Conclusion

  1. Subversion is dead.
  2. git-flow is very useful.
    • But it has some problems.
  3. To use advanced git-flow is the solution.
    • Add -R | --remote option

One more thing

git-now is a command-line tool for light and temporary commit. It commits with a log message from time now and diff.