git: Add PushTo
to select which remote to push (#31482)
mostly, I using `git checkout -b branch_name upstream/main` to create new branch which reference remote upstream not my fork. When using `Push` will always failed with not permission. So we need ability to select which remote to push. Current branch is based on my previous pr #26897 Release Notes: - Add `PushTo` to select which remote to push. --------- Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
parent
9775747ba9
commit
cf5e76b1b9
3 changed files with 30 additions and 8 deletions
|
@ -75,7 +75,15 @@ pub fn init(cx: &mut App) {
|
|||
return;
|
||||
};
|
||||
panel.update(cx, |panel, cx| {
|
||||
panel.push(false, window, cx);
|
||||
panel.push(false, false, window, cx);
|
||||
});
|
||||
});
|
||||
workspace.register_action(|workspace, _: &git::PushTo, window, cx| {
|
||||
let Some(panel) = workspace.panel::<git_panel::GitPanel>(cx) else {
|
||||
return;
|
||||
};
|
||||
panel.update(cx, |panel, cx| {
|
||||
panel.push(false, true, window, cx);
|
||||
});
|
||||
});
|
||||
workspace.register_action(|workspace, _: &git::ForcePush, window, cx| {
|
||||
|
@ -83,7 +91,7 @@ pub fn init(cx: &mut App) {
|
|||
return;
|
||||
};
|
||||
panel.update(cx, |panel, cx| {
|
||||
panel.push(true, window, cx);
|
||||
panel.push(true, false, window, cx);
|
||||
});
|
||||
});
|
||||
workspace.register_action(|workspace, _: &git::Pull, window, cx| {
|
||||
|
@ -379,6 +387,7 @@ mod remote_button {
|
|||
.action("Pull", git::Pull.boxed_clone())
|
||||
.separator()
|
||||
.action("Push", git::Push.boxed_clone())
|
||||
.action("Push To", git::PushTo.boxed_clone())
|
||||
.action("Force Push", git::ForcePush.boxed_clone())
|
||||
}))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue