From 1228b2c838e7f4fb598516750bd176e14ad7593e Mon Sep 17 00:00:00 2001 From: Agam Agarwal Date: Wed, 9 Jul 2025 08:38:55 +0530 Subject: [PATCH] jj-git-*: add pages (#17143) --- pages/common/jj-git-clone.md | 21 +++++++++++++++++++++ pages/common/jj-git-fetch.md | 20 ++++++++++++++++++++ pages/common/jj-git-init.md | 21 +++++++++++++++++++++ pages/common/jj-git-push.md | 32 ++++++++++++++++++++++++++++++++ pages/common/jj-git-remote.md | 24 ++++++++++++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 pages/common/jj-git-clone.md create mode 100644 pages/common/jj-git-fetch.md create mode 100644 pages/common/jj-git-init.md create mode 100644 pages/common/jj-git-push.md create mode 100644 pages/common/jj-git-remote.md diff --git a/pages/common/jj-git-clone.md b/pages/common/jj-git-clone.md new file mode 100644 index 0000000000..d81360128e --- /dev/null +++ b/pages/common/jj-git-clone.md @@ -0,0 +1,21 @@ +# jj git clone + +> Create a new repo backed by a clone of a Git repo. +> Note: Unless `--colocate` is used, it is not a valid Git repository and `git` commands can't be used on it. +> More information: . + +- Create a new repo backed by a clone of a Git repo into a new directory (the default directory is the repository name): + +`jj git clone {{source}} {{path/to/directory}}` + +- Create a clone and use the given name for newly created remote: + +`jj git clone --remote {{remote_name}} {{source}}` + +- Clone a Git repo, only fetching the 10 most recent commits: + +`jj git clone --depth {{10}} {{source}}` + +- Clone colocating the Jujutsu repo with the Git repo (allowing the use of both `jj` and `git` commands in the same directory): + +`jj git clone --colocate {{source}}` diff --git a/pages/common/jj-git-fetch.md b/pages/common/jj-git-fetch.md new file mode 100644 index 0000000000..accd001172 --- /dev/null +++ b/pages/common/jj-git-fetch.md @@ -0,0 +1,20 @@ +# jj git fetch + +> Fetch from a Git remote, downloading objects and refs from the remote repository. +> More information: . + +- Fetch the latest changes from the default remote repository: + +`jj git fetch` + +- Fetch the latest changes from a given remote repository: + +`jj git fetch --remote {{remote}}` + +- Fetch the latest changes only from given branches: + +`jj git fetch {{[-b|--branch]}} {{branch}}` + +- Fetch the latest changes from all remotes: + +`jj git fetch --all-remote` diff --git a/pages/common/jj-git-init.md b/pages/common/jj-git-init.md new file mode 100644 index 0000000000..01a45a5894 --- /dev/null +++ b/pages/common/jj-git-init.md @@ -0,0 +1,21 @@ +# jj git init + +> Create a new Git backed Jujutsu repo. +> Note: Unless `--colocate` is used, it is not a valid Git repository and `git` commands can't be used on it. +> More information: . + +- Create a new Git backed repo in the current directory: + +`jj git init` + +- Create a new Git backed repo in the given directory: + +`jj git init {{path/to/directory}}` + +- Initialize the Jujutsu repository as a valid Git repository (allowing the use of both `jj` and `git` commands in the same directory): + +`jj git init --colocate` + +- Initialize the Jujutsu repository backed by an existing Git repository: + +`jj git init --git-repo {{git_repo}}` diff --git a/pages/common/jj-git-push.md b/pages/common/jj-git-push.md new file mode 100644 index 0000000000..520553eb14 --- /dev/null +++ b/pages/common/jj-git-push.md @@ -0,0 +1,32 @@ +# jj git push + +> Push to a Git remote. +> More information: . + +- Push a bookmark to the given remote (defaults to `git.push` setting): + +`jj git push {{[-b|--bookmark]}} {{bookmark}} --remote {{remote}}` + +- Push a new bookmark: + +`jj git push {{[-b|--bookmark]}} {{bookmark}} {{[-N|--allow-new]}}` + +- Push all tracked bookmarks: + +`jj git push --tracked` + +- Push all bookmarks (including new bookmarks): + +`jj git push --all` + +- Push all bookmarks pointing to given revisions: + +`jj git push {{[-r|--revisions]}} {{revset}}` + +- Push changes/commits by creating new bookmarks (Name format is as per `templates.git_push_bookmark` setting, defaults to `"push-" ++ change_id.short()`): + +`jj git push {{[-c|--change]}} {{revset}}` + +- Push a revision with the given name: + +`jj git push --named {{name}}={{revision}}` diff --git a/pages/common/jj-git-remote.md b/pages/common/jj-git-remote.md new file mode 100644 index 0000000000..4c15e20ef8 --- /dev/null +++ b/pages/common/jj-git-remote.md @@ -0,0 +1,24 @@ +# jj git remote + +> Manage Git remotes. +> More information: . + +- List all Git remotes: + +`jj git remote list` + +- Add a Git remote: + +`jj git remote add {{remote}} {{url}}` + +- Change the URL of a Git remote: + +`jj git remote set-url {{remote}} {{url}}` + +- Remove a Git remote: + +`jj git remote remove {{remote}}` + +- Rename a Git remote: + +`jj git remote rename {{old_name}} {{new_name}}`