From: Peter Wolanin Date: Fri, 14 Mar 2014 20:49:37 GMT Subject: bug report: regression in git subtree add Message-ID: In this commit: https://github.com/git/git/commit/10a49587fabde88c0afbc80a99d97fae91811f5f git subtree add for a remote repository and branch was fundamentally broken. It works by chance if a local branch exists that matches the name of the desired remote branch. Thus, "master" happens to work and the bug possibly escapes common notice. cmd_add_repository() does a git fetch - the desired remote refspec can never be found in the local repo until that git fetch is run, so the attempt to validate it within cmd_add() is wrong - if desired, that should happen after the fetch in cmd_add_repository(). I think the additions shown in lines 505 and 506 should be reverted, since the rev is also checked in cmd_add_commit() Best, Peter Wolanin