diff --git a/README.md b/README.md index 22f0676..8785d7b 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`. * [Apply commit from another repository](#apply-commit-from-another-repository) * [Specific fetch reference](#specific-fetch-reference) * [Find common ancestor of two branches](#find-common-ancestor-of-two-branches) +* [List unpushed git commits](#list-unpushed-git-commits) @@ -979,5 +980,21 @@ git fetch origin master:refs/remotes/origin/mymaster diff -u <(git rev-list --first-parent BranchA) <(git rev-list --first-parent BranchB) | sed -ne 's/^ //p' | head -1 ``` +## List unpushed git commits +```sh +git log --branches --not --remotes +``` + + +__Alternatives:__ +```sh +git log @{u}.. +``` + + +```sh +git cherry -v +``` + diff --git a/tips.json b/tips.json index c4cd799..0d44021 100644 --- a/tips.json +++ b/tips.json @@ -421,4 +421,8 @@ }, { "title": "Find common ancestor of two branches", "tip": "diff -u <(git rev-list --first-parent BranchA) <(git rev-list --first-parent BranchB) | sed -ne 's/^ //p' | head -1" +}, { + "title": "List unpushed git commits", + "tip": "git log --branches --not --remotes", + "alternatives": ["git log @{u}..", "git cherry -v"] }]