Skip to content

Sauter Git Workflow : Working on an existing feature

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

SourceTree

  • Checkout the branch you want to work-on (e.g. the branch "new-files-format")

  • Make your changes
    You can see them immediately in the SourceTree application:

    Changes In SourceTree

  • Commit by clicking on the Commit button in the upper left corner and stage the files to be changed, then finish the commit edition by clicking on Commit in the bottom right corner.

    Commit changes on a new feature Before committing changes, you have to "stage" them.

You can use either the buttons as shown in the picture...
...or you can drag & drop the files you want to stage

![Drag & Drop Changes](pictures/drag&drop-changes-into-staging-area.jpg)
  • Click on Pull to get others developers changes and to be able to Push

    Pull to get others developers state

  • Click on Push to push the changes you've made, select only the branch you are working on.
    Again its a good idea to use the context menu of the branch in the navigation bar, because the branch you are working on is selected by default

    Push Feature Branch Changes

Command Line

  • Checkout the branch you want to work-on (e.g. the branch "new-files-format")

  • Make your changes
    You can see them immediately with git status or with git gui :

    Changes In git gui

  • Commit by staging the files to be changed, then finish the commit edition by clicking on Commit in the bottom right corner.

    Using git gui is equivalent to performing staging operations via the command line :

    git add changed-file.c
    git rm --cached changed-file-that-we-want-to-commit-later.c
    git commit
  • After a commit it's important to Pull other developers change, in order to then push a clean merged history.

    You chan pull changes for the remotely tracked branch as such :

    git pull origin
  • Then Push the changes you've made, select only the branch you are working on.

    Finally send your changes to the others :

    git push origin feature/new-files-format