Viewing unpushed Git commits

前端 未结 25 2353
Happy的楠姐
Happy的楠姐 2020-11-22 08:05

How can I view any local commits I\'ve made, that haven\'t yet been pushed to the remote repository? Occasionally, git status will print out that my branch is X

25条回答
  •  无人及你
    2020-11-22 09:00

    Here's my portable solution (shell script which works on Windows too without additional install) which shows the differences from origin for all branches: git-fetch-log

    An example output:

    ==== branch [behind 1]
    
    > commit 652b883 (origin/branch)
    | Author: BimbaLaszlo 
    | Date:   2016-03-10 09:11:11 +0100
    |
    |     Commit on remote
    |
    o commit 2304667 (branch)
      Author: BimbaLaszlo 
      Date:   2015-08-28 13:21:13 +0200
    
          Commit on local
    
    ==== master [ahead 1]
    
    < commit 280ccf8 (master)
    | Author: BimbaLaszlo 
    | Date:   2016-03-25 21:42:55 +0100
    |
    |     Commit on local
    |
    o commit 2369465 (origin/master, origin/HEAD)
      Author: BimbaLaszlo 
      Date:   2016-03-10 09:02:52 +0100
    
          Commit on remote
    
    ==== test [ahead 1, behind 1]
    
    < commit 83a3161 (test)
    | Author: BimbaLaszlo 
    | Date:   2016-03-25 22:50:00 +0100
    |
    |     Diverged from remote
    |
    | > commit 4aafec7 (origin/test)
    |/  Author: BimbaLaszlo 
    |   Date:   2016-03-14 10:34:28 +0100
    |
    |       Pushed remote
    |
    o commit 0fccef3
      Author: BimbaLaszlo 
      Date:   2015-09-03 10:33:39 +0200
    
          Last common commit
    

    Parameters passed for log, e.g. --oneline or --patch can be used.

提交回复
热议问题