Change how update-deps updates a git branch
Change how update-deps updates a git branch

Previously, update-deps on a dep tagged as {branch, ...} would do the
following:

  git fetch
  git checkout -q origin/<branch>

If you were already on that branch, the repo would end up in detached
head state. This is kind of annoying if you're doing local development.

This patch changes the behaviour to be

  git fetch
  git checkout -q <branch>
  git pull --ff-only --no-rebase -q <branch>

The intent of this is to move the branch's HEAD forward to match
upstream without destroying any local commits or changes, and without
accidentally causing merges or rebases. It will fail if the operation
can not be performed without losing history, merging or rebasing.

The previous behaviour has been around a very long time:

https://github.com/rebar/rebar/commit/064195dc5a90f5b0cc3ae92e8373671b0043033f#L0R308

It also exactly mirrors the download_source case, which is not really
true. With git tags and SHAs, one can assume that they don't change, but
branches move all the time.

saleyn/rebar3,matwey/rebar,scatterbrain/rebar,dcarastan/rebar,csyangchen/rebar,matwey/rebar,matwey/rebar,dcarastan/rebar,rebar/rebar3,cloudant/couchdb-rebar,processone/rebar3,fauxsoup/rebar3,choptastic/rebar,macintux/rebar,norton/rebar,basho/rebar,wcy123/rebar,zugolosian/rebar3,evnix/rebar,jacktang/rebar,ferd/rebar3,beni55/rebar-1,linearregression/rebar3,matwey/rebar,oubiwann/rebar,basho/rebar,heroku/rebar,beni55/rebar,evnix/rebar,kellymclaughlin/rebar3,SiDen/rebar,jbalint/rebar3,bsmr-erlang/rebar,vladdu/rebar3,shkumagai/rebar,project-fifo/rebar3,scatterbrain/rebar,GabrielNicolasAvellaneda/rebar,benoitc/rebar3,syl20bnr/rebar,paulo-ferraz-oliveira/rebar,syl20bnr/rebar,project-fifo/rebar3,paulo-ferraz-oliveira/rebar,K2InformaticsGmbH/rebar,choptastic/rebar,jbalint/rebar3,cloudant/couchdb-rebar,K2InformaticsGmbH/rebar,dcarastan/rebar,linearregression/rebar3,sile/rebar3,K2InformaticsGmbH/rebar,norton/rebar,csyangchen/rebar,walrusVision/rebar3,bsmr-erlang/rebar,lrascao/rebar,cloudant/couchdb-rebar,K2InformaticsGmbH/rebar,syl20bnr/rebar,SiDen/rebar,platinumthinker/rebar,platinumthinker/rebar,beni55/rebar,surik/rebar3,jacktang/rebar,bsmr-erlang/rebar,choptastic/rebar,sile/rebar3,surik/rebar3,jacktang/rebar,norton/rebar,csyangchen/rebar,lrascao/rebar,djnym/rebar3,apache/couchdb-rebar,GabrielNicolasAvellaneda/rebar,apache/couchdb-rebar,rebar/rebar3,platinumthinker/rebar,tsloughter/rebar3,benoitc/rebar3,lrascao/rebar,evnix/rebar,lpgauth/rebar,K2InformaticsGmbH/rebar,beni55/rebar-1,shkumagai/rebar,oubiwann/rebar,zugolosian/rebar3,SiDen/rebar,CMoH/rebar,shkumagai/rebar,CMoH/rebar,matwey/rebar,heroku/rebar,lpgauth/rebar,rebar/rebar,walrusVision/rebar3,wcy123/rebar,scatterbrain/rebar,GabrielNicolasAvellaneda/rebar,rebar/rebar,fabiankrol/rebar3,RubberCthulhu/rebar,macintux/rebar,RubberCthulhu/rebar,bsmr-erlang/rebar,beni55/rebar,apache/couchdb-rebar,CMoH/rebar,lrascao/rebar3,erlang/rebar3,norton/rebar,blt/rebar3,rebar/rebar,fabiankrol/rebar3,lrascao/rebar,lpgauth/rebar,processone/rebar3,lrascao/rebar,macintux/rebar,norton/rebar3,oubiwann/rebar,fishcakez/rebar3,paulo-ferraz-oliveira/rebar,fauxsoup/rebar3,blt/rebar3