1

I want to learn how to use git with svn repository.

I follow this manual: http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion

I make some changes in my file. Some of them staged, some of them not:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   CHANGES.txt
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   CHANGES.txt
#

According to the manual I first commit staged changes into my local repository:

$ git commit -m "new"
[master 21bf2bd] new
 1 file changed, 1 insertion(+)

now I have only unstages changes, which I want to live like it is for the future commits:

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   CHANGES.txt
#
no changes added to commit (use "git add" and/or "git commit -a")

And I want to push local commits upstream to svn:

$ git svn dcommit         
CHANGES.txt: needs update
update-index --refresh: command returned error: 1

Why can't I do it?

When can I use "dcommit" and when I can't? I clearly lack this information, and I wasn't able to find more description in google or man pages.

klm123
  • 12,105
  • 14
  • 57
  • 95
  • 1
    Check this: http://stackoverflow.com/questions/5367734/error-rebaseing-updating-a-git-svn-repository – pmod Nov 11 '13 at 21:52

1 Answers1

2

You can't have any non-commited changes when you do dcommit.

To temporarily hide your modifications, use git stash. Then commit with git svn dcommit, and finally pop the stash with git stash pop to enable your modifications once again.

pigelin
  • 143
  • 1
  • 8