Skip to content

Commit 418b227

Browse files
author
Jorge Marin
committed
Add tip for first commit in a branch
1 parent 93e25eb commit 418b227

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
119119
* [Show all local branches ordered by recent commits](#show-all-local-branches-ordered-by-recent-commits)
120120
* [Find lines matching the pattern (regex or string) in tracked files](#find-lines-matching-the-pattern-regex-or-string-in-tracked-files)
121121
* [Clone a shallow copy of a repository](#clone-a-shallow-copy-of-a-repository)
122+
* [Get first commit in a branch (from master)](#get-first-commit-in-a-branch-from-master)
122123

123124
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
124125
<!-- @doxie.inject end toc -->
@@ -828,5 +829,10 @@ git grep --heading --line-number 'foo bar'
828829
git clone https://github.com/user/repo.git --depth 1
829830
```
830831

832+
## Get first commit in a branch (from master)
833+
```sh
834+
git log master..<branch-name> --oneline | tail -1
835+
```
836+
831837
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
832838
<!-- @doxie.inject end -->

tips.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,7 @@
361361
}, {
362362
"title": "Clone a shallow copy of a repository",
363363
"tip": "git clone https://github.com/user/repo.git --depth 1"
364+
}, {
365+
"title": "Get first commit in a branch (from master)",
366+
"tip": "git log master..<branch-name> --oneline | tail -1"
364367
}]

0 commit comments

Comments
 (0)