Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demos: update README demos #4237

Merged
merged 6 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ the header of the website when you scroll to the top of any page.

Jujutsu is designed so that the underlying data and storage model is abstract.
Today, it features two [backends]—one of them uses a Git repository for storage,
while the other is a native storage backend[^native-backend].
while the other is a native storage backend[^native-backend]. The Git backend
uses the [libgit2](https://libgit2.org/) C library and the
[gitoxide](https://github.com/Byron/gitoxide) Rust library.

[backends]: https://martinvonz.github.io/jj/latest/glossary#backend

Expand All @@ -204,10 +206,11 @@ backend. The backend exists mainly to make sure that it's possible to eventually
add functionality that cannot easily be added to the Git backend.

The Git backend is fully featured and maintained, and allows you to use Jujutsu
as an alternative interface to Git. The commits you create will look like
regular Git commits. You can always switch back to Git. The Git support uses the
[libgit2](https://libgit2.org/) C library.

with any Git remote. The commits you create will look like regular Git commits.
You can fetch branches from a regular Git remote and push branches to the
remote. You can always switch back to Git.

Here is how you can explore a GitHub repository with `jj`.

<img src="demos/git_compat.png" />

Expand Down
20 changes: 18 additions & 2 deletions demos/demo_git_compat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,26 @@ comment "Clone a Git repo:"
run_command "jj git clone https://github.com/octocat/Hello-World"
run_command "cd Hello-World"

comment "Inspect it:"
run_command "jj log -r 'all()'"
blank

comment "By default, \"jj\" creates a local master branch tracking the remote master
branch. The other branches are only available as remote-tracking branches."
run_command "jj branch list --all"
comment "We can create a local branch tracking one of the remote branches we just
fetched."
run_command "jj branch track octocat-patch-1@origin"

comment "By default, \"jj log\" excludes untracked remote branches to focus on
\"our\" commits."
run_command "jj log"

comment "We can also ask \"jj\" to show all the commits."
run_command "jj log -r 'all()'"

comment "We can look at the diffs of commits in the repo"
run_command "jj diff -r b1"
blank
run_command "jj diff -r b3"

comment "The repo is backed by the actual Git repo:"
run_command "git --git-dir=.jj/repo/store/git log --graph --all --decorate --oneline"
Expand Down
8 changes: 4 additions & 4 deletions demos/demo_juggle_conflicts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ new_tmp_dir
echo "third" > file
jj branch create third
jj commit -m 'third'
) >/dev/null
) >/dev/null 2>&1

comment "We are in a repo with three commits, all
editing the same line:"
Expand All @@ -25,21 +25,21 @@ run_command "jj diff -r second"
run_command "jj diff -r third"

comment "Let's reorder the second and third commits:"
run_command "jj rebase -s third -d first"
run_command_output_redacted "jj rebase -s third -d first"
run_command "jj rebase -s second -d third"
run_command "jj log"
comment "The commit labeled \"third\" has a conflict, as expected. What's more
interesting is that the top commit has no conflict! That's because it
has the changes from all three commits applied to it.

Let's verify that by looking at its contents:"
run_command "jj co second"
run_command "jj new second"
run_command "cat file"

comment "Let's now instead make \"second\" and \"third\"
sibling and merge them:"
run_command "jj rebase -s second -d first"
run_command "jj merge second third -m merged"
run_command "jj new second third -m merged"
run_command "jj log"
comment "Again, because the merge commit has the
changes from all three commits, it has no
Expand Down
7 changes: 4 additions & 3 deletions demos/demo_operation_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ new_tmp_dir
{
jj git clone https://github.com/octocat/Hello-World
cd Hello-World
jj abandon octocat-patch-1
jj abandon --ignore-immutable octocat-patch-1@origin
jj branch forget octocat-patch-1
} > /dev/null
jj branch track test@origin
} > /dev/null 2>&1

comment "We are in the octocat/Hello-World repo.
The \"operation log\" shows the operations
Expand All @@ -24,7 +25,7 @@ run_command "jj rebase -d test"

comment "We are now going to make another change off of
master:"
run_command "jj co master"
run_command "jj new master"
run_command "jj describe -m \"other stuff\""

comment "The repo now looks like this:"
Expand Down
4 changes: 2 additions & 2 deletions demos/demo_resolve_conflicts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ new_tmp_dir
{
jj git clone https://github.com/octocat/Hello-World
cd Hello-World
jj abandon test
jj abandon --ignore-immutable test@origin
jj branch forget test
} > /dev/null
} > /dev/null 2>&1

comment "We are on the master branch of the
octocat/Hello-World repo:"
Expand Down
8 changes: 4 additions & 4 deletions demos/demo_working_copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ new_tmp_dir
{
jj git clone https://github.com/octocat/Hello-World
cd Hello-World
jj abandon test
jj abandon --ignore-immutable test@origin
jj branch forget test
jj abandon octocat-patch-1
jj abandon --ignore-immutable octocat-patch-1@origin
jj branch forget octocat-patch-1
}> /dev/null
}> /dev/null 2>&1

comment "We are in the octocat/Hello-World repo.
We have an empty working copy on top of master:"
Expand All @@ -31,7 +31,7 @@ run_command "jj branch create goodbye"
run_command "jj log"

comment "Start working on a new change off of master:"
run_command "jj co master"
run_command "jj new master"
comment "Note that we were told the working copy is now empty (AKA clean). The
\"goodbye\" change stayed in its own commit:"

Expand Down
Binary file modified demos/git_compat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading