git - Switch branch preserving files -
background
i've been running both subversion , git on single codebase. works well: can commit existing remote subversion repository, , use git local backup storing temporary commits. can commit git working, continue tidying before committing subversion sharing others.
i'm know using git-svn this, i'm happy solution have. unless goes wrong , need backtrack, git write-only.
what i'm trying do
if switch branches in subversion, can commit git's master
branch , start tracking again there. feel better have branches in git mirror in subversion there fewer files stage in git each time.
how can switch branches in git without checking out branch? want files change based on svn switch, not overwritten git. want changes available staging in git if had made them manually, , have work each time switch between branches.
you can use git symbolic-ref
purpose. $branch
local git branch trying switch to:
git symbolic-ref head refs/heads/$branch
you may want follow command git reset
update index match state of branch head
targets. (this of course discard index manipulations have done, not affect files in working copy.)
Comments
Post a Comment