Wednesday, August 17, 2016

Git: How to commit and merge

Hi,
I'm using Git just one year, and in second team, so here are three "algorithms" or "patterns" which I recognized yet:

1. Git+Gerrit+Jira, branch, commit --amend, upload

  • create branch per Jira item  
  • develop code
  • try to pull
  • solve merge conflicts
  • commit
  • upload (push + upload to gerrit )
  • ... wait for gerrit review ...
  • change code (regarding gerrit review)
  • try to pull
  • solve merge commits
  • commit --amend (rewrite your commit - be careful )
  • upload
  • ...
This is probably good solution for big projects with long term gerrit review process ...

2. Git+Gitlab, master, stash, merge, push

Probable suitable just for not so big project (lines/changes/developers)
Just one branch used locally.
  • You will change code.
  • When there is something new on origin/master you will try to pull
  • If it is impossible to pull, you will stash changes
    • pull
    • stash apply - solve merge conflicts 
  • continue if needed
  • push ( no review before push)

3. Git+Gitlab, master, commit, merge, push

The same as above but stash is not used, just commit and push.
But then merge commits will appears.

Probable suitable just for not so big project (lines/changes/developers)
Just one branch used locally.
  • You will change code.
  • When there is something new on origin/master you will try to pull
  • If is impossible to pull, you will commit changes
    • pull
    • solve merge conflicts 
  • continue if needed
  • push ( no review before push)

Any other ideas ?

No comments:

Post a Comment