git-svn create branch off past revision

I know how to create an svn branch w/git. But, can I do that off of a past revision/commit ?

  • Cannot push to github with Powershell
  • Git: How to handle git libraries in project
  • How to patch code in someone else's project hosted on github
  • git fatal:No tags can describe <sha1 number>
  • HEAD detached at the HEAD commit id, what's the meaning?
  • Atlassian SourceTree does not show remote branches?
  • Linking code coverage to version control
  • Is there a commercial grade Git server product
  • git on UNC path
  • Update Git branches from master
  • Git core.editor on Mac OS X
  • Git removing upstream from local repository
  • 2 Solutions collect form web for “git-svn create branch off past revision”

    Answer for myself (and anyone else) – not strictly git-svn, but it works:

    svn copy https://foo.com/svn/bar/trunk/@6635 https://foo.com/svn/bar/branches/mybranch -m 'creating a branch'
    # in your git working directory
    git svn fetch
    git branch -a
    

    You should see remotes/mybranch in that list, now create a local branch that tracks that remote

    git checkout -b local_mybranch remotes/mybranch
    

    You just need to switch to (checkout) that revision first. Here’s an example using git-svn only:

    git checkout <sha1-of-past-commit>
    git svn branch -m "Create branch for v1.2.3 hotfixes" hotfix-1.2.3
    git checkout -b hotfix-1.2.3 remotes/hotfix-1.2.3
    

    Tested on Git for Windows 1.9.0.msysgit.0.

    Git Baby is a git and github fan, let's start git clone.