#[non_exhaustive]pub struct GitPush {
pub remote: String,
pub refspec: String,
pub set_upstream: bool,
}Expand description
Options for GitApi::push (git push).
#[non_exhaustive], so build it through GitPush::branch /
GitPush::refspec rather than a struct literal.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.remote: StringRemote to push to (defaults to origin).
refspec: StringThe refspec — a bare branch name, or local:remote_branch.
set_upstream: boolSet the pushed branch as the upstream (-u).
Implementations§
Source§impl GitPush
impl GitPush
Sourcepub fn branch(name: impl Into<String>) -> Self
pub fn branch(name: impl Into<String>) -> Self
Push branch name to origin under the same name (git push origin <name>).
Sourcepub fn refspec(local: impl AsRef<str>, remote_branch: impl AsRef<str>) -> Self
pub fn refspec(local: impl AsRef<str>, remote_branch: impl AsRef<str>) -> Self
Push local to a differently-named remote_branch
(git push origin <local>:<remote_branch>).
Sourcepub fn set_upstream(self) -> Self
pub fn set_upstream(self) -> Self
Record the pushed branch as the local branch’s upstream (-u).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GitPush
impl RefUnwindSafe for GitPush
impl Send for GitPush
impl Sync for GitPush
impl Unpin for GitPush
impl UnsafeUnpin for GitPush
impl UnwindSafe for GitPush
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more