Command (or script) similar to git status to show all local commits since last git svn dcommit?

前端 未结 5 1338
梦如初夏
梦如初夏 2021-01-13 14:14

This python script is the best I have come up with so far. I just hacked it together and on a cursory first couple uses, seems to be acting correctly, but I can\'t help but

相关标签:
5条回答
  • 2021-01-13 14:39

    One of (they are synonyms):

    git svn dcommit --dry-run
    git svn dcommit -n
    
    0 讨论(0)
  • 2021-01-13 14:41

    After playing around with Greg's suggestion, I ended up with this:

    git log remotes/trunk.. --oneline
    

    which I will either alias or wrap in a small script.

    The reason why this works and his suggestion didn't is that my remopte svn branch is remotes/trunk not git-svn. I don't know if this is standard or not, especially since Greg assumed git-svn.

    0 讨论(0)
  • 2021-01-13 14:44

    First, do a git branch -a to list all the remote branches:

    $ git branch -a
      git-svn
    

    For me, only the git-svn branch is listed, but you may have different names depending on what options you passed to git svn clone. Then, use

    git log git-svn..
    

    (substituting your appropriate name for git-svn). The above command (note the two trailing dots ..) shows all the commits on the current branch since the nearest common ancestor of the current branch and the git-svn branch.

    0 讨论(0)
  • 2021-01-13 14:44

    I added this to my ~/.gitconfig file:

    svn-status = !"git log `git svn log --show-commit --oneline --limit=1 | awk '{print $3}'`..HEAD --oneline"
    

    which gives handy short messages if there are any changes that need dcommit, and shows nothing if you're up to date (assuming you've done a rebase or fetch). you could modify the params to the outer git-log if you like too.

    0 讨论(0)
  • 2021-01-13 14:59

    Nice. Based on the info here, I use:

    git config alias.svn-status \!"git log git-svn.. --oneline |wc|perl -ne 'tr/ //s;s/^ //;(\$commits)=split(/ /,\$_,2);print \"Your branch is ahead of git-svn by \$commits commits\n\"'"

    This assumes the standard git-svn default remote repo nomenclature.

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