Commit Diff


commit - ea0bbcf85814cba68a68039e391ed8df51ea4a1e
commit + cc54c5012c3c6f6ee05e749ef9f02331304b76df
blob - 1103aa277a4635a8fe84c1c7112afb0056d03ded
blob + 4b86514a735a9ad06b93d1c336f8a6f226160b80
--- got/got.1
+++ got/got.1
@@ -253,6 +253,11 @@ if invoked in a work tree, or to the repository's HEAD
 Set the number of context lines shown in diffs with
 .Fl p .
 By default, 3 lines of context are shown.
+.It Fl f
+Restrict history traversal to the first parent of each commit.
+This shows the linear history of the current branch only.
+Merge commits which affected the current branch will be shown but
+individual commits which originated on other branches will be omitted.
 .It Fl l Ar N
 Limit history traversal to a given number of commits.
 .It Fl p
@@ -744,7 +749,7 @@ In a work tree or a git repository directory, view cha
 the 3 most recent commits to the work tree's branch, or the branch resolved
 via the repository's HEAD reference, respectively:
 .Pp
-.Dl $ got log -p -l 3 -b
+.Dl $ got log -p -l 3 -f
 .Pp
 Add new files and remove obsolete files in a work tree directory:
 .Pp
blob - 2f7d8b5ef12121c16e9340c8363bb580459f61da
blob + 25dbaaa0f5aa282827f7966bd24df070e5dda59a
--- got/got.c
+++ got/got.c
@@ -1366,7 +1366,7 @@ done:
 __dead static void
 usage_log(void)
 {
-	fprintf(stderr, "usage: %s log [-b] [-c commit] [-C number] [ -l N ] [-p] "
+	fprintf(stderr, "usage: %s log [-c commit] [-C number] [-f] [ -l N ] [-p] "
 	    "[-r repository-path] [path]\n", getprogname());
 	exit(1);
 }
@@ -1395,11 +1395,8 @@ cmd_log(int argc, char *argv[])
 		err(1, "pledge");
 #endif
 
-	while ((ch = getopt(argc, argv, "bpc:C:l:r:")) != -1) {
+	while ((ch = getopt(argc, argv, "b:pc:C:l:fr:")) != -1) {
 		switch (ch) {
-		case 'b':
-			first_parent_traversal = 1;
-			break;
 		case 'p':
 			show_patch = 1;
 			break;
@@ -1416,6 +1413,9 @@ cmd_log(int argc, char *argv[])
 			limit = strtonum(optarg, 1, INT_MAX, &errstr);
 			if (errstr != NULL)
 				err(1, "-l option %s", errstr);
+			break;
+		case 'f':
+			first_parent_traversal = 1;
 			break;
 		case 'r':
 			repo_path = realpath(optarg, NULL);