This is strange. I'm trying to make a script that will checkout every local branch and rebase origin/master onto it.
So this is my script:
for br in `git branch -l`; do
git checkout $br
git rebase origin/master
done
Simple. But before I made the script, I wanted to make sure that `git branch -l` returns what I think it is returning.....it isn't.
git branch -l
returns the correct result. But `git branch -l` is actually returning all local branch PLUS the files in the current dir!
It returns it like this:
[list of local branches minus master] [list of files in the current dir] master
`git branch --list` behaves the same way.
Why is this happening?
And is there a better way to rebase origin/master to all local branches?