Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see what has been checked into git, but hasn't been committed to svn via dcommit?

I'm using git-svn. How can I get a list of what I've committed into git, but haven't yet committed to the SVN repository since the last git svn dcommit? That is, how can I verify what is about to be sent if I do a dcommit?

like image 510
Matt V. Avatar asked May 18 '11 01:05

Matt V.


People also ask

Can I use git and SVN at the same time?

You can clone a subversion repository to your machine using git svn clone <SVN repo URL> . The code will be available as a git repository. You can do your work there and make local commits as you please. There is a command line option to get a "shallow" checkout rather than the entire repository which is often useful.

Is SVN easier than git?

SVN has one central repository – which makes it easier for managers to have more of a top down approach to control, security, permissions, mirrors and dumps. Additionally, many say SVN is easier to use than Git. For example, it is easier to create a new feature.

Which features of git make it attractive over SVN?

The biggest difference between Git vs Subversion (SVN) is that Git version control is distributed while SVN is centralized. There are also key differences in repositories, branching, and more. If you're considering switching from SVN to Git, you'll want to take these into account.


2 Answers

The --dry-run option for git svn dcommit is very useful for finding out exactly what will be committed to Subversion. In particular that has the properties that:

  • It doesn't actually commit anything to Subversion
  • It tells you which diffs will be calculated to create new revisions in Subversion
  • It tells you which branch in Subversion you will be committing to - this is sometimes non-obvious, since it is taken from the Subversion branch specified in the first ancestor commit with a git-svn-id in its commit message

In general it's a good idea to do git svn rebase before even thinking about using dcommit, so that your history is linearized - otherwise merge commits may not make much sense in the Subversion history. (If you've done that, then git log and gitk --all will also be essentially equivalent, but I think git svn dcommit --dry-run gives you a more accurate picture of what's about to happen, even if it's more difficult to interpret.)

like image 198
Mark Longair Avatar answered Oct 23 '22 03:10

Mark Longair


The easiest way I think is to do this using gitk. You will want the --all option to see all branches. If you have not used it before simply type:

gitk --all

You will see a graphical view of your branches. When you update from SVN, you essentially do a rebase (git svn rebase). This means any local commits that are not checked in to SVN will appear on the branch after the last SVN commit. Basically look at the commits between your remote SVN trunk and your master branch.

like image 35
Chris Dail Avatar answered Oct 23 '22 03:10

Chris Dail