diff --git a/README.md b/README.md index e6bad6b700..136624e881 100644 --- a/README.md +++ b/README.md @@ -203,8 +203,9 @@ 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. +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. The Git support uses +the [libgit2](https://libgit2.org/) C library. diff --git a/demos/demo_git_compat.sh b/demos/demo_git_compat.sh index b45e37578b..3bed891a86 100755 --- a/demos/demo_git_compat.sh +++ b/demos/demo_git_compat.sh @@ -8,10 +8,23 @@ comment "Clone a Git repo:" run_command "jj git clone https://github.com/octocat/Hello-World" run_command "cd Hello-World" -comment "Inspect it:" +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\" shows the commits jj considers \"ours\" together +with their parents." +run_command "jj log" + +comment "We can also ask \"jj\" to show all the commits." run_command "jj log -r 'all()'" -blank + +comment "We can look at the commits in the repo" run_command "jj diff -r b1" +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" diff --git a/demos/git_compat.svg b/demos/git_compat.svg index e6a05b85cc..eeda196218 100644 --- a/demos/git_compat.svg +++ b/demos/git_compat.svg @@ -1,5 +1,5 @@ - + - + # Clone a Git repo: $ jj git clone https://github.com/octocat/Hello-World Fetching into new repo in "/private/var/folders/lj/rv4h95_d0mxb9ryztzpz4qph0000g -n/T/tmp.ZOYBCmWXWw/Hello-World" +n/T/tmp.nJjvMtatLT/Hello-World" branch: master@origin          [new] untracked branch: octocat-patch-1@origin [new] untracked branch: test@origin            [new] untracked Setting the revset alias "trunk()" to "master@origin" -Working copy now at: smorvwyr 9712552b (empty) (no description set) -Parent commit      : orrkosyo 7fd1a60b master | (empty) Merge pull request #6 fr +Working copy now at: oowkwslp ba9eed87 (empty) (no description set) +Parent commit      : orrkosyo 7fd1a60b master | (empty) Merge pull request #6 fr om Spaceghost/patch-1 Added 1 files, modified 0 files, removed 0 files $ cd Hello-World -# Inspect it: - -$ jj log -r 'all()' -@  smorvwyr jjfan@example.com 2024-08-07 22:13:24 9712552b -│  (empty) (no description set) -│   tpstlust support+octocat@github.com 2018-05-10 10:55:19 -├─╯  octocat-patch-1@origin b1b3f972 -│    sentence case -│   kowxouwz octocat@nowhere.com 2014-06-10 15:22:26 test@origin b3cbd5bb -├─╯  Create CONTRIBUTING.md -    orrkosyo octocat@nowhere.com 2012-03-06 16:06:50 master 7fd1a60b -├─╮  (empty) Merge pull request #6 from Spaceghost/patch-1 -│   nznozkvv Johnneylee.rollins@gmail.com 2011-09-13 21:42:41 76294131 -├─╯  New line at end of file. --Signed off by Spaceghost -  syktoqts cameron@github.com 2011-01-26 12:06:08 553c2077 -│  first commit -  zzzzzzzz root() 00000000 - -$ jj diff -r b1 -Modified regular file README: -   1    1: Hello Worldworld! - -# The repo is backed by the actual Git repo: - -$ git --git-dir=.jj/repo/store/git log --graph --all --decorate --oneline -9712552  -| * 52c4d07  -| * b1b3f97 (origin/octocat-patch-1) sentence case -|/   -| * b3cbd5b (origin/test) Create CONTRIBUTING.md -|/   -*   7fd1a60 (origin/master) Merge pull request #6 from Spaceghost/patch-1 -|\   -| * 7629413 New line at end of file. --Signed off by Spaceghost -|/   -553c207 first commit +# By default, "jj" creates a local master branch tracking the remote master +# branch. The other branches are only available as remote-tracking branches. + +$ jj branch list --all +masterorrkosyo 7fd1a60b (empty) Merge pull request #6 from Spaceghost/patch-1 +  @originorrkosyo 7fd1a60b (empty) Merge pull request #6 from Spaceghost/patch +-1 +octocat-patch-1@origintpstlust b1b3f972 sentence case +test@originkowxouwz b3cbd5bb Create CONTRIBUTING.md + +# We can create a local branch tracking one of the remote branches we just +# fetched. + +$ jj branch track octocat-patch-1@origin +Started tracking 1 remote branches. + +# By default, "jj log" shows the commits jj considers "ours" together +# with their parents. + +$ jj log +@  oowkwslp jjfan@example.com 2024-08-07 22:56:18 ba9eed87 +│  (empty) (no description set) +│ ○  tpstlust support+octocat@github.com 2018-05-10 10:55:19 octocat-patch-1 +├─╯  b1b3f972 +│    sentence case +  orrkosyo octocat@nowhere.com 2012-03-06 16:06:50 master 7fd1a60b +│  (empty) Merge pull request #6 from Spaceghost/patch-1 +~ + +# We can also ask "jj" to show all the commits. + +$ jj log -r 'all()' +@  oowkwslp jjfan@example.com 2024-08-07 22:56:18 ba9eed87 +│  (empty) (no description set) +│ ○  tpstlust support+octocat@github.com 2018-05-10 10:55:19 octocat-patch-1 +├─╯  b1b3f972 +│    sentence case +│   kowxouwz octocat@nowhere.com 2014-06-10 15:22:26 test@origin b3cbd5bb +├─╯  Create CONTRIBUTING.md +    orrkosyo octocat@nowhere.com 2012-03-06 16:06:50 master 7fd1a60b +├─╮  (empty) Merge pull request #6 from Spaceghost/patch-1 +│   nznozkvv Johnneylee.rollins@gmail.com 2011-09-13 21:42:41 76294131 +├─╯  New line at end of file. --Signed off by Spaceghost +  syktoqts cameron@github.com 2011-01-26 12:06:08 553c2077 +│  first commit +  zzzzzzzz root() 00000000 + +# We can look at the commits in the repo + +$ jj diff -r b1 +Modified regular file README: +   1    1: Hello Worldworld! +$ jj diff -r b3 +Added regular file CONTRIBUTING.md: +        1## Contributing + +# The repo is backed by the actual Git repo: + +$ git --git-dir=.jj/repo/store/git log --graph --all --decorate --oneline +ba9eed8  +| * 86fed3a  +| * b1b3f97 (origin/octocat-patch-1) sentence case +|/   +| * b3cbd5b (origin/test) Create CONTRIBUTING.md +|/   +*   7fd1a60 (origin/master) Merge pull request #6 from Spaceghost/patch-1 +|\   +| * 7629413 New line at end of file. --Signed off by Spaceghost +|/   +553c207 first commit