2

I would like to know if there any way to push multiple commits from local Git repository to remote SVN repository and do not merge them into one single commit?

I am using SmartGit and let's say I have 5 commits in my local GIT branch, this branch referenced to remote SVN /trunk, when push those commits to SVN I get one big commit in SVN

Thanks in advance for any help

5
  • I am using SmartGit GUI client, will 'git svn dcommit' solve my problem? Commented Aug 12, 2012 at 3:53
  • I don't know how gui client works but git svn command to make it is that, try if that will help you. Commented Aug 12, 2012 at 7:27
  • I don't understand the problem. I use SmartGit for SVN, and when I press 'Push' it pushes 1 SVN commit per 1 Git commit... Maybe you have 5 commits in an anonymous Git branch, that is not translated to SVN. In this case you should name a branch for the anonymous branches and push it first. Commented Aug 12, 2012 at 12:19
  • What do mean be anonymous branch? My workflow is looks like as: 1. Create local git branch "X". 2. Make let's say 4 commits in local branch "X" 3. Merge local git branch "X" to main git branch, which is linked to svn trunk. 4. Pull from SVN repository 5. Push to SVN repository. After item 5. I get 1 revision in SVN repository "Merged from branch'X'" Commented Aug 13, 2012 at 1:25
  • 1
    @iKiR that's exactly the problem: in the main git branch (let's call it trunk) you just have one "merge" commit, the 5 merge source commits can't be pushed as SVN does not support multiple lines of history in one branch. Hence, instead of merging branch X to trunk, Rebase your five commits onto trunk, so you just have a linear history. Commented May 31, 2013 at 8:54

1 Answer 1

1

From your additional comments, it sounds like the problem is your merge. I recommend reading the git merge documentation, particularly the section on "fast-forward merges". It sounds like your client is doing a "no-ff" merge, which combines the commits on branch X into a single merge commit on your main branch. When you push to SVN it's that single merge commit that's being pushed across.

What you want is a fast-forward merge. From the command-line you can ensure you get this by using git merge --ff-only. I'm not familiar with SmartGit, but from the docs it looks like it offers you this option when you request a merge: http://www.syntevo.com/smartgithg/documentation.html?page=commands-branch#merge

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.