-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: make
log
show only local commits by default
The default log output of showing all commits is not very useful when contributing to an existing repo. Let's have it default to showing commits not on any remote branch instead. I think that's the best we can do since we don't have a configurable main branch yet, and we don't even have per-repo configuration.. Closes #250.
- Loading branch information
1 parent
bb99ab7
commit 5f94daf
Showing
6 changed files
with
33 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,36 +128,31 @@ working copy commit by default. | |
## The log command, "revsets", and aliases | ||
|
||
You're probably familiar with `git log`. Jujutsu has very similar functionality | ||
in its `jj log` command. It produces hundreds of lines of output, so let's pipe | ||
its output into `head`: | ||
in its `jj log` command: | ||
```shell script | ||
$ jj log | head | ||
$ jj log | ||
@ 192b456b024b f39aeb1a0200 [email protected] 2021-05-23 23:10:27.000 -07:00 | ||
| | ||
o fb563a4c6d26 f63e76f175b9 [email protected] 2021-05-23 22:13:45.000 -07:00 | ||
| Jujutsu is ready! | ||
o 080a9b37ff7e 6a91b4ba16c7 [email protected] 2021-05-23 22:08:37.000 -07:00 main | ||
| cli: make `jj st` show parent commit before working copy commit | ||
o ba8ff31e32fd 302257bdb7e5 [email protected] 2021-05-23 22:08:12.000 -07:00 | ||
| cli: make the working copy changes in `jj status` clearer | ||
o dcfc888f50b3 7eddf8dfc70d [email protected] 2021-05-23 22:07:40.000 -07:00 | ||
| cli: remove "Done" message at end of git clone | ||
~ cli: make `jj st` show parent commit before working copy commit | ||
``` | ||
|
||
The `@` indicates the working copy commit. The first hash on a line is the | ||
commit ID. The second hash is a "change ID", which is an ID that follows the | ||
commit as it's rewritten (similar to Gerrit's Change-Id). You can give either | ||
hash to commands that take revisions as arguments. We will generally prefer | ||
change ids because they stay the same when the commit is rewritten. | ||
|
||
By default, `jj log` lists all revisions (commits) in the repo that have not | ||
been rewritten (roughly speaking). We can use the `-r` flag to restrict which | ||
revisions we want to list. The flag accepts a ["revset"](revsets.md), which is | ||
an expression in a simple language for specifying revisions. For example, `@` | ||
refers to the working copy commit, `root` refers to the root commit, | ||
`branches()` refers to all commits pointed to by branches. We can combine | ||
expressions with `|` for union, `&` for intersection and `~` for difference. | ||
For example: | ||
change IDs because they stay the same when the commit is rewritten. | ||
|
||
By default, `jj log` list your local commits, with some remote commits added for | ||
context. The `~` indicates that the commit has parents that are not included | ||
in the graph. We can use the `-r` flag to select a different set of revisions we | ||
want to list. The flag accepts a ["revset"](revsets.md), which is an expression | ||
in a simple language for specifying revisions. For example, `@` refers to the | ||
working copy commit, `root` refers to the root commit, `branches()` refers to | ||
all commits pointed to by branches. We can combine expressions with `|` for | ||
union, `&` for intersection and `~` for difference. For example: | ||
```shell script | ||
$ jj log -r '@ | root | branches()' | ||
@ 192b456b024b f39aeb1a0200 [email protected] 2021-05-23 23:10:27.000 -07:00 | ||
|
@@ -174,23 +169,7 @@ There are also operators for getting the parents (`foo-`), children (`foo+`), | |
ancestors (`:foo`), descendants (`foo:`), DAG range (`foo:bar`, like | ||
`git log --ancestry-path`), range (`foo..bar`, same as Git's). There are also a | ||
few more functions, such as `heads(<set>)`, which filters out revisions in the | ||
input set if they're ancestors of other revisions in the set. Let's define an | ||
alias based on that by adding the following to `~/.jjconfig.toml`: | ||
``` | ||
[alias] | ||
l = ["log", "-r", "(heads(remote_branches())..@):"] | ||
``` | ||
|
||
The alias lets us run `jj l` to see the commits we have created between public | ||
heads (exclusive) and the working copy (inclusive), as well as their | ||
descendants: | ||
```shell script | ||
$ jj l | ||
@ 192b456b024b f39aeb1a0200 [email protected] 2021-05-23 23:10:27.000 -07:00 | ||
| | ||
o fb563a4c6d26 f63e76f175b9 [email protected] 2021-05-23 22:13:45.000 -07:00 | ||
~ Jujutsu is ready! | ||
``` | ||
input set if they're ancestors of other revisions in the set. | ||
|
||
## Conflicts | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters