Preview a Git push

后端 未结 4 1941
广开言路
广开言路 2020-12-28 12:30

How can I see which commits are actually going to be pushed to a remote repository?

As far as I know, whenever I pull master from the remote repository, com

4条回答
  •  自闭症患者
    2020-12-28 12:58

    If you drop this into your Bash profile you'll be able to run grin (Git remote incoming) and grout (Git remote outgoing) to see diffs of commits that are incoming and outgoing for origin master:

    function parse_git_branch {
      git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
    }
    
    function gd2 {
        echo branch \($1\) has these commits and \($2\) does not
        git log $2..$1 --no-merges --format='%h | Author:%an | Date:%ad | %s' --date=local
    }
    
    function grin {
        git fetch origin master
        gd2 FETCH_HEAD $(parse_git_branch)
    }
    
    function grout {
        git fetch origin master
        gd2 $(parse_git_branch) FETCH_HEAD
    }
    

提交回复
热议问题