Viewing unpushed Git commits

前端 未结 25 2973
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

    Handy git alias for looking for unpushed commits in current branch:

    alias unpushed = !GIT_CURRENT_BRANCH=$(git name-rev --name-only HEAD) && git log origin/$GIT_CURRENT_BRANCH..$GIT_CURRENT_BRANCH --oneline
    

    What this basically does:

    git log origin/branch..branch
    

    but also determines current branch name.

提交回复
热议问题