0

I'm using git-for-windows and want to write a bash function to update the current working branch to master. Here is what i have written:

sync() { 
        branch = $(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
        git checkout master
        git pull origin/master
        git checkout $branch
}

However, when i call this function, it throws an error:

bash: branch: command not found

How can i solve this problem?

Rene Knop
  • 1,788
  • 3
  • 15
  • 27
Bartek
  • 2,109
  • 6
  • 29
  • 40

1 Answers1

1

Remove the whitespace between the = so it reads:

branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')

spartygw
  • 3,289
  • 2
  • 27
  • 51