Git Workflows

Best Practices

Tri Tran

April 2019 @ TRANSCOSMOS TECHNOLOGIC ARTS

about me

 

Tri Tran

(Trần Đăng Trí)

 

Senior Technical Architect

.NFQ Asia

 

Co-Founder & Technical Lead

tablen.com

IdeasOn

 

I'm very happy if you call me Mụp

@moprit

we WILL discuss about

  • Git && Git workflows
     
  • Some best practices in using Git
     
  • Recommendations

we WON'T talk about

  • GIT and the others, which one is the best
     
  • CI / CD
     
  • EPL, C1, DOTA 2, Counter Strike...

Git Workflows

  • Centralized workflow
     

  • Feature-branches workflow
     

  • Gitflow workflow
     

  • Forking workflow

Here we go!

Centralized workflow

  • Like SVN (Subversion)
     

  • Using a central repository and single branch
     

  • For teams transitioning from SVN or Individual

Feature-branches workflow

  • 1 master branch && feature branches
     

  • Merge pull request
     

  • For multiple developers to work on a particular feature, and single ENV

Gitflow workflow

  • Many public branches or separated ENV: master, staging, develop, etc…
     

  • Using feature branches and then merge pull request to a particular
     

  • Using release branches
     

  • For multiple developers to work on a multiple ENV

Forking workflow

  • Like Github - Open-source contribution
     

  • Using over two remote repositories

    • 1 official repository

    • N developer repositories

Best Practices

  • Naming
     
  • Reset / Checkout
     
  • Merge vs. Rebase

Merge vs. Rebase

Merge

  • Create “merge commit”
     
  • Non-destructive operation

Merge vs. Rebase

Rebase

  • Alternative to merging This moves the entire current branch to begin on the tip of the target branch
     
  • Re-write the history

Merge vs. Rebase

The Golden Rule of Rebasing

 

Never use Rebase on public branches

Recommendations

  • Commit Often, Using WIP message or Stash
     
  • Write Good Commit Messages
     
  • NEVER just git commit directly to master or public branches
     
  • Don’t let secrets leak into source code
     
  • Using Gitignore (Gitignore.io)

References

It's time to move forward

Thanks

Tri D. Tran

trandangtri@gmail.com

@moprit

Git workflows and Recommendations

By Tri Tran

Git workflows and Recommendations

A Git workshop for Transcosmos Technologic Arts. We discussed about Git Workflows, especially Gitflow, and some best practices in using Git

  • 399