开发者

I tagged in git-svn, and now my master always commits to the svn tag!

I've got a basic git-svn setup:

   [core]
           repositoryformatversion = 0
           filemod开发者_C百科e = false
           bare = false
           logallrefupdates = true
           symlinks = false
           ignorecase = true
           hideDotFiles = dotGitOnly
           autocrlf = true
   [svn-remote "svn"]
           url = https://svnserver:8443/svn/Project
           fetch = trunk:refs/remotes/trunk
           branches = branches/*:refs/remotes/*
           tags = tags/*:refs/remotes/tags/*

I created a tag off the trunk (master in git) by issuing the following:

git svn tag -m "3.6.1" 3.6.1

This created a new tag in svn at /tags/3.6.1. In addition, I saw a new /remotes/tags/3.6.1 listed in my remote branches.

At some point, I'd checkout out a local branch from the 3.6.1 remote and made some changes. Then I merged them into the master (I think this was a big mistake). So my master seems to think it has some history from the 3.6.1 tag.

Now every time I commit something to my master then dcommit, they're going to the 3.6.1 tag!

jakes@mymachine /cygdrive/d/Projects/Project (master)
$ git svn dcommit
Committing to https://svnserver:8443/svn/Project/tags/3.6.1 ...
    M       fileThatChanged.js
Committed r6027

Is there an easy way I can set things straight again?


Been a while since I've used git svn, but try a command like this:

git branch --set-upstream svn/trunk

or

git branch --set-upstream refs/remotes/trunk

If that doesn't work can you post the [branch "master"] section of your git config as well?


I know this is an old question but figured I'd post anyway. I didn't have luck using --set-upstream (or the more recent --set-upstream-to). If you don't have changes in your local branch, you can do something like

git checkout remotes/trunk
git checkout -B master

That will recreate your local master from remotes/trunk. The same workflow could be applied to remote branches that you want to track locally.

To prevent the issue happening that you referred to, I've found the best way to merge is using

git merge --no-ff local/feature_branch
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜