Pops
Pops

Reputation: 30868

What SVN command can I use to see the branch I'm currently using?

I generally use Subclipse, but there's some wonkiness in my code right now and I want to do some sanity checks from the command line. Thanks to Subclipse, I can usually see the branches I'm using in Eclipse's Package Explorer window.

screenshot of branch information in Eclipse

What command can I use from the command line to see the branch I'm currently using?

Resources I tried before Stack Overflow include the SVN book, this list of commands and this other list of commands. I didn't find anything that would let me passively look at branch information (as opposed to making some sort of active branch modification, which is not what I want).

Upvotes: 56

Views: 57730

Answers (4)

mooreds
mooreds

Reputation: 4978

'svn info' from https://edoras.sdsu.edu/doc/svn-book-html-chunk/svn.ref.svn.c.info.html

The branch is what shows up in the URL below:

$ svn info foo.c
Path: foo.c
Name: foo.c
URL: http://svn.red-bean.com/repos/test/foo.c
Repository Root: http://svn.red-bean.com/repos/test
Repository UUID: 5e7d134a-54fb-0310-bd04-b611643e5c25
Revision: 4417
Node Kind: file
Schedule: normal
Last Changed Author: sally
Last Changed Rev: 20
Last Changed Date: 2003-01-13 16:43:13 -0600 (Mon, 13 Jan 2003)
Text Last Updated: 2003-01-16 21:18:16 -0600 (Thu, 16 Jan 2003)
Properties Last Updated: 2003-01-13 21:50:19 -0600 (Mon, 13 Jan 2003)
Checksum: d6aeb60b0662ccceb6bce4bac344cb66

Upvotes: 5

oaklandrichie
oaklandrichie

Reputation: 491

With some regex, you can get just the branch name:

svn info | grep '^URL:' | egrep -o '(tags|branches)/[^/]+|trunk' | egrep -o '[^/]+$'

Upvotes: 19

JayM
JayM

Reputation: 4938

svn info will tell you the origin of your working copy. From that you can tell the branch.

Upvotes: 5

Joshua McKinnon
Joshua McKinnon

Reputation: 24719

Try the following:

svn info

This will give you the URL your workspace is a checkout of, relative to where you are in the workspace. You should be able to see the branch in the URL.

Upvotes: 101

Related Questions