Skip to content

Sauter Git Workflow : Finishing a feature

Damien Buhl (alias daminetreg) edited this page Aug 4, 2014 · 7 revisions

Once the feature is finished you can merge back the changes into develop with Git Flow :

  • Change to branch „develop“

  • „pull“ to the latest commits from server

  • Change back to your feature branch

  • SourceTree

  • Command Line

SourceTree

  • Click on Git Flow

  • Click on the Finish Feature button

    Finish a feature

  • On the new window select the feature to finish and merge back in the develop branch. Let everything by default ( i.e. Rebase unchecked, Delete branch checked and Force deletion unchecked).

    Confirm the feature finish, deleting the branch which was used for the feature

  • Once done the local feature branch ( e.g. feature/ui-redesign) is merged into develop and the local feature branch is deleted, while the branch in the remote repository is not deleted. ( Note: You usually want to remove the remote branch later when you tag a final version and you know you don't need any changes to a current feature. )
    You can see the results of this operation if you click "Show Full Output".

    Merged Feature Output

  • Click on Push to push the changes you've made, select only the develop branch, as it's the branch you want to share with others developers : you just merged the feature branch into develop
    Again its better to use the context menu of the branch develop in the navigation bar than the push button in the toolbar.

Command-Line

  • To finish a feature, which means merging back the changes in develop and deleting the local feature branch, you can issue the following command :

    git flow feature finish additional-feature
    Switched to branch 'develop'
    Your branch is up-to-date with 'origin/develop'.
    Merge made by the 'recursive' strategy.
     bam  | 0
     boom | 0
     2 files changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 bam
     create mode 100644 boom
    Deleted branch feature/additional-feature (was a6362ea).
    
    Summary of actions:
    - The feature branch 'feature/additional-feature' was merged into 'develop'
    - Feature branch 'feature/additional-feature' has been removed
    - You are now on branch 'develop' 
    
  • Now you can push the merged develop branch :

    git push origin develop
  • And after this delete safely the feature branch available online :

    git push origin :feature/additional-feature

    This basically means push nothing in place of ( i.e. ":" ) feature/additional-feature. Which removes the branch only if all it's changes were fully-merged. This way no changes can be lost.