user128511
user128511

Reputation:

auto update svn from git

Here's what I would like to do. Is it possible

No one else will ever commit to the svn repo. It's one direction only. From git to svn. It will only ever take changes to master on git and add them to svn. svn is basically an svn version of a master branch.

I thought I could just do

git svn dcommit

over and over as in

..edit, push and or pull files..
git commit -a -m "foo1"
git svn dcommit
..edit, push and or pull files..
git commit -a -m "foo1"
git svn dcommit
..edit, push and or pull files..
git commit -a -m "foo1"
git svn dcommit

But that doesn't seem to work. I keep getting conflicts and messages like

$ git svn dcommit
Committing to https://my.svn.repo/svn/ ...
        M       README.md
Committed r18619
        M       README.md
r18619 = 8f00073a3f1987e97a0f0f194798b6e02e9b0345 (refs/remotes/git-svn)
No changes between current HEAD and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn
Unstaged changes after reset:
M       README.md
        M       README.md
Committed r18620
        M       README.md
r18620 = 47313477c1e38959fadd43d0001ff55210637669 (refs/remotes/git-svn)
No changes between current HEAD and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn

That seems fishy. git status gives me

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 2 and 2 different commits each, respectively.
#

I feel like I'm fundamentally missing something. Like maybe I shouldn't be using git-svn at all. In fact if all I did was this

cd ~/git-folder
..edit files..
git commit -a -m "foo"
cd ~/svn-folder
cp -r ~/git-folder .
svn commit -m "foo"

It would actually work, I'd just lose all the commit messages and individual commits.

Can someone point out what I'm missing

Upvotes: 1

Views: 472

Answers (2)

Dmitry Pavlenko
Dmitry Pavlenko

Reputation: 8958

Everything is ok. There's no relation between 'origin/master' and git-svn that uses refs/remotes/git-svn to reflect SVN state. 'master' and 'origin/master' diverged because git-svn doesn't touch 'origin/master' but replaces commits in 'master' with commits with (usually) the same content but with "git-svn-id" signature in the commit message (so sha-1 hashes are changed this way).

Upvotes: 2

cdhowie
cdhowie

Reputation: 168958

The output from git svn dcommit looks fine to me, it is just recreating the Git commits in the SVN repository. If you svn co the SVN repository, you would see the same commits.

I suspect that you have cloned the Git repository from somewhere else, or have pushed the repository, as indicated by the fact that you have an origin/master branch; git-svn branches are not added under an origin remote.

In other words, I don't see anything here to cause alarm. Everything appears to be working as expected.

Upvotes: 0

Related Questions