Viewing unpushed Git commits

前端 未结 25 2970
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:05

    I believe the most typical way of doing this is to run something like:

    git cherry --abbrev=7 -v @{upstream}
    

    However, I personally prefer running:

    git log --graph --decorate --pretty=oneline --abbrev-commit --all @{upstream}^..
    

    which shows the commits from all branches which are not merged upstream, plus the last commit in upstream (which shows up as a root node for all the other commits). I use it so often that I have created alias noup for it.

    git config --global alias.noup \
    'log --graph --decorate --pretty=oneline --abbrev-commit --all @{upstream}^..'
    

提交回复
热议问题