I want to create a new branch and check it out. However, if the branch name I'm creating already exists, I don't want to get an error, I simply want git to update the already existing branch to the point I'm checking it out at.
Here is what I'm doing:
$ git branch
develop
* foobar
$ git checkout -b develop origin/develop
fatal: A branch named 'develop' already exists.
$ git update-ref refs/heads/develop origin/develop
$ git checkout develop
Switched to branch 'develop'
$ git branch
* develop
foobar
$
Here is something like what I want:
$ git checkout --update-if-exists -b develop origin/develop
Switched to branch 'develop'
$ git branch
* develop
foobar
$