Q:

How can I ensure, to have different workflows for Travis CI for different git branches

I am setting up a CI pipeline. 
I have a script which build docker images. 
In travis.yml it's something like this. 
script
  - bash builddocker.sh

I want to be able to use the same script and run in such a way that, it builds images and pushes to a different repository for different branches. 
For example, for master, push it to dev-docker-repository
for feature branches, push it to `team-test-repository'

A:

This is something you could handle inside your script by giving it the branch in parameter e.g.
script:
  - bash builddocker.sh $TRAVIS_BRANCH

Otherwise it would also be possible to use build stages and define different jobs depending on the branch e.g.
jobs:
  include:
    - name: master branch
      script: bash builddocker.sh dev-docker-repository
      if: branch = master
    - name: other branches
      script: bash builddocker.sh team-test-repository
      if: branch ! = master

Hope this helps! 