How can I do "git svn dcommit" on a single branch?

I'm using SourceTree to connect with my comany's svn server. I want to commit some changes on one of my branches. I click "Push" and get a sheet that looks to me like it's locked into pushing all tracked branches, which is definitely not what I want. Is there some way to change that?

Also, why don't my remote svn branches show up under Remotes?

1 answer

1 accepted

This widget could not be displayed.

The 'All Tracked Branches' comment in the window is actually misleading; 'git svn dcommit' in fact only sends commits for your current HEAD (ie only your currently checked out branch). I'll change the text so that's clearer.

The original reason the svn remote / branches are not shown in the sidebar was because you can't operate on them the same way as for a git remote, but they do have one use - checking out extra branches if you cloned from the root. Right now you can only do this from the log window. I'll log a feature request to allow this from the sidebar too (a much more restricted feature set than regular remote branches).

Looking at the latest version the messaging is much more clear, so that's a big improvement. Nice!

However, the inability to see the svn branches is crippling. It leaves me flying blind -- what are the available branches? How do I check them out? How do I jump to them in the history list? I'm glad that you filed a feature request for that and I hope you are able to address it soon, because I'm afraid I can't use sourcetree for git-svn development without it.

The only way you'd ever see all the branches is if you'd cloned from the root of the svn repo (from the parent of /trunk, /branches etc).

Generally though, I'd recommend using separate git repos for each svn branch if you're keeping the Subversion repo upstream. That's because if you have all the branches there, you'll be tempted to do things that git-svn doesn't support, like performing merges between (svn) branches, and end up getting in a mess. My advice is to use different git repos per svn branch while you're maintaining the upstream svn repo, then do a complete conversion from the root (including all branches) when you finally ditch Subversion.

It's actually totally sensible to see all the branches of a specific project in git-svn, and you don't need to clone from the root of the repo. You add them en masse as remotes using the "branches" and "tags" directives in .git/config's svn-remote section. I add the "demos" directory as a "branches" source and when I need to check out the demo branch that my coworker set up in svn it's right there in my list of remotes. Tower and GitX-L work this way, no sweat. Heck, when I run git branch -a they show up in my list of remote branches, so I'm guessing you're actively filtering them out.

As for avoiding things that git-svn doesn't support, I would hope that my shiny high-tech tools would take care of that for me, but even if they don't it's not terribly hard to do. Separate repos for each svn branch is a complete non-starter though. That's just throwing away 90% of the power of git. You might as well just use subversion at that point.

I'm not actively filtering anything out, so I'll look into this.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

883 views 2 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you