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

后端 未结 4 369
孤街浪徒
孤街浪徒 2020-12-31 08:42

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

相关标签:
4条回答
  • 2020-12-31 08:52

    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.)

    0 讨论(0)
  • 2020-12-31 09:01

    I use git log --oneline --graph:

    * aaaaaaa commit message
    *   bbbbbbb commit message 
    |\  
    | * ccccccc commit message
    | * ffffdffffdd commit message
    | * eeeeeee commit message
    |/  
    *   fffffff commit message 
    |\  
    ...

    It's easy to see that commits aaaaaaa, bbbbbbb, and fffffff are on the current (master) branch. These commits either have already been or will be committed to Subversion the next time you execute git svn dcommit. (Commits ccccccc, ffffdffffdd, eeeeeee are on a separate branch which was merged into master and will not be committed to Subversion as separate commits.)

    0 讨论(0)
  • 2020-12-31 09:05

    To just see the list of commits, here's my magic:

    git svn dcommit -n  | sed 1d | cut -d" " -f3 | xargs -I{} git log --oneline --no-walk {}
    

    output:

    c2e1eff changed a thing
    a889dbf changed a second thing
    18a4653 undid the second thing-- oops
    
    0 讨论(0)
  • 2020-12-31 09:08

    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.

    0 讨论(0)
提交回复
热议问题