My remote git repo has two branches 'master' (for the next release) and 'maint' (for fixing bugs in the current release). These branches are tracked locally. I am on 'master' which is up-to-date. Someone pushed changes in 'maint' to the remote which I want to merge into 'master'. The obvious way is:
git checkout maint
git pull
git checkout master
git merge maint
git push
However, this will excessively touch my working copy, leading to long recompilation times for master. Is there a sequence of git commands which achieves the merge without checkout, i.e., without touching the local files that are unaffected by the last patches in maint I am merging in?
I tried
git merge origin/maint
which did the job for master, but then maint is behind and the subsequent
git push
fails, complaining about the maint -> maint part. To get maint up to date, I had to
git checkout maint
git pull
but this is precisely what I want to avoid.