Viewing unpushed Git commits

前端 未结 25 2345
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 08:52
    git cherry -v
    

    This will list out your local comment history (not yet pushed) with corresponding message

    0 讨论(0)
  • 2020-11-22 08:54

    This worked better for me:

    git log --oneline @{upstream}..
    

    or:

    git log --oneline origin/(remotebranch)..
    
    0 讨论(0)
  • 2020-11-22 08:54

    To list all unpushed commit in all branches easily you can use this command:

     git log --branches  @{u}..
    
    0 讨论(0)
  • 2020-11-22 08:57

    You can do this with git log:

    git log origin..
    

    Assuming that origin is the name of your upstream, leaving off any revision name after .. implies HEAD, which lists the new commits that haven't been pushed.

    0 讨论(0)
  • 2020-11-22 08:57

    It is not a bug. What you probably seeing is git status after a failed auto-merge where the changes from the remote are fetched but not yet merged.

    To see the commits between local repo and remote do this:

    git fetch
    

    This is 100% safe and will not mock up your working copy. If there were changes git status wil show X commits ahead of origin/master.

    You can now show log of commits that are in the remote but not in the local:

    git log HEAD..origin
    
    0 讨论(0)
  • 2020-11-22 08:59
    git log origin/master..HEAD
    

    You can also view the diff using the same syntax

    git diff origin/master..HEAD
    
    0 讨论(0)
提交回复
热议问题