Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git - what is the best practice for team work on a feature branch?

We have the following branches:
master and develop.
We created a new branch feature off of develop and assigned a team to work on it.
During development:

  • remote develop accepts new commits by other teams.
  • remote feature accepts new commits pushed by the team members working on it.

Sometimes there are hot fixes pushed to develop that need to be updated in feature as well.
Of course, at the end of the cycle, feature should be merged into develop.

We don't have a single workflow to keeping feature and it's local copies in sync with develop, and then making sure all local copies are based on the same commit.

My suggested workflow is as follows:

Keeping up-to-date with develop

  1. New commits are pushed to develop
  2. I rebase the feature branch:

    git checkout feature
    git pull --rebase origin develop
    git push origin feature
    
  3. All local feature copies run: git pull --rebase origin feature

Updating the feature branch from local copies

  1. A team member has finished his work on the feature branch
  2. He makes sure his local copy is up to date: git pull --rebase origin feature
  3. He merges his commits into feature:

    git checkout feature
    git pull origin feature
    git merge local-feature
    git push origin feature
    

Merging the feature branch into develop

  1. I make sure feature is up to date with develop:

    git checkout feature
    git pull --rebase origin develop
    
  2. I merge into develop:

    git checkout develop
    git pull origin develop
    git merge feature
    git push origin develop
    

We do all that pull --rebase stuff in order to keep linear flow and make sure all our changes are merged using fast-forward.
However, as you can tell, there are a lot of commands to run every time.

Is this really necessary? Are we doing it the "right" way?
Would you suggest another flow?

like image 871
user1102018 Avatar asked Jul 12 '14 20:07

user1102018


1 Answers

I assume you follow this model: http://nvie.com/posts/a-successful-git-branching-model/

enter image description here

I think most of the demonstrated commands are correct, you can however make things easier by implementing git alliasses

like image 150
Willem Van Onsem Avatar answered Sep 20 '22 00:09

Willem Van Onsem