Handling features/fixes (Git)

1. Create a feature/fix branch
Don’t work straight on the parent branch if you have to implement a feature/fix, atleast if more then one person is working on that branch.

$ git checkout <parent> && git pull
$ git checkout -b <feature|fix>
$ git push -u <remote> <feature|fix>

2. Add changes on the branch
While implementing your changes try to seperate them into multiple commits and push them on the remote that other developer can review them.

$ git add .
$ git commit -m "<message>"
$ git push

3. Bring your changes on the parent
If you want a short linear branch history without merge commits you have to rebase, squash and merge instead of just merging all commits.

$ git pull --rebase
$ git checkout <parent>
$ git merge --squash <feature|fix>
$ git commit -m "<message>"
$ git push

4. Delete your created branch
As soon as your changes are on the parent branch you should delete your created feature/fix branch locally and also on the remote repository.

$ git branch -d <feature|fix>
$ git push -d <remote> <feature|fix>