git: Add support for git pull with rebase (#41117)

- Adds a new action `git::PullRebase` which adds `--rebase` in the final
command invoked by existing Git-Pull implementation.
- Includes the new action in "Fetch/Push" button in the Git Panel
(screenshot below)
- Adds key-binding for `git::PullRebase` in all three platforms,
following the existing key-binding patterns (`ctrl-g shift-down`)
- Update git docs to include the new action.

Sidenote: This is my first ever OSS contribution

Screenshot:

<img width="234" height="215" alt="image"
src="https://github.com/user-attachments/assets/713d068f-5ea5-444f-8d66-444ca65affc8"
/>

---

Release Notes:

- Git: Added `git: pull rebase` for running `git pull --rebase`.
This commit is contained in:
Sathiyaraman M
2025-11-04 16:41:06 +00:00
committed by GitHub
parent 9f580464f0
commit 982f2418f4
11 changed files with 79 additions and 46 deletions
+2
View File
@@ -72,6 +72,8 @@ actions!(
ForcePush,
/// Pulls changes from the remote repository.
Pull,
/// Pulls changes from the remote repository with rebase.
PullRebase,
/// Fetches changes from the remote repository.
Fetch,
/// Fetches changes from a specific remote.
+9 -1
View File
@@ -533,6 +533,7 @@ pub trait GitRepository: Send + Sync {
&self,
branch_name: String,
upstream_name: String,
rebase: bool,
askpass: AskPassDelegate,
env: Arc<HashMap<String, String>>,
// This method takes an AsyncApp to ensure it's invoked on the main thread,
@@ -1690,6 +1691,7 @@ impl GitRepository for RealGitRepository {
&self,
branch_name: String,
remote_name: String,
rebase: bool,
ask_pass: AskPassDelegate,
env: Arc<HashMap<String, String>>,
cx: AsyncApp,
@@ -1703,7 +1705,13 @@ impl GitRepository for RealGitRepository {
command
.envs(env.iter())
.current_dir(&working_directory?)
.args(["pull"])
.arg("pull");
if rebase {
command.arg("--rebase");
}
command
.arg(remote_name)
.arg(branch_name)
.stdout(smol::process::Stdio::piped())