From d88c338fd04a79a809feff9c1d45cebd134f9658 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 23 Mar 2022 13:23:37 -0500 Subject: [PATCH 1/3] docs: Point people to git-branch-stash Before, git-branch-stash was bundled with git-stack. We've separated them, so we need to tell the user where to get it. Fixes #221 --- README.md | 15 +++++++++++++++ docs/reference.md | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 195da6e..aa1c40d 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,13 @@ Or use rust to install: $ cargo install git-stack ``` +We also recommend installing +[`git-branch-stash`](https://github.com/gitext-rs/git-branch-stash) for easily +undoing `git stack` operations: +```console +$ cargo install git-branch-stash-cli +``` + ### Uninstall See the uninstall method for your installer. @@ -204,6 +211,14 @@ If a commit summary is only `WIP` or is prefixed by: *This includes the prefixes used by [Gitlab](https://docs.gitlab.com/ee/user/project/merge_requests/drafts.html)* +### What is `git branch-staash` + +[`git-branch-stash`](https://github.com/gitext-rs/git-branch-stash) is a +separate utility that is like `git stash` for instead of your working tree, it +stashes what commit each of your branches points to. `git stack` backs up +using `git branch-stash`s file format to lower the risk of trying things out +with `git stack`. + ### Why don't you just ...? Have an idea, we'd love to [hear it](https://github.com/gitext-rs/git-stack/discussions)! diff --git a/docs/reference.md b/docs/reference.md index dd40481..e2d67d5 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -104,7 +104,9 @@ Why not `git push --set-upstream --force-with-lease origin `? ### `git branch-stash` -While `git stash` backs up and restores your working tree, `git branch-stash` backs up and restores the state of all of your branches. +While `git stash` backs up and restores your working tree, +[`git branch-stash`](https://github.com/gitext-rs/git-branch-stash) backs up +and restores the state of all of your branches. `git-stack` implicitly does a `git branch-stash` whenever modifying the tree. From 373fbf7b1610bdcfc5369bac9275b0c1a0046dca Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 7 Apr 2022 20:00:20 -0500 Subject: [PATCH 2/3] chore: Upgrade termtree --- Cargo.lock | 10 ++++++++-- Cargo.toml | 2 +- src/bin/git-stack/stack.rs | 12 ++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b44c70..67342e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -400,7 +400,7 @@ dependencies = [ "log", "maplit", "proc-exit", - "termtree", + "termtree 0.4.0", "yansi", ] @@ -758,7 +758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d86de6de25020a36c6d3643a86d9a6a9f552107c0559c60ea03551b5e16c032" dependencies = [ "predicates-core", - "termtree", + "termtree 0.2.4", ] [[package]] @@ -1029,6 +1029,12 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "507e9898683b6c43a9aa55b64259b721b52ba226e0f3779137e50ad114a4c90b" +[[package]] +name = "termtree" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" + [[package]] name = "textwrap" version = "0.14.2" diff --git a/Cargo.toml b/Cargo.toml index 2fcebec..8e34f2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ concolor-clap = { version = "0.0.9", features = ["api_unstable"] } proc-exit = "1" eyre = "0.6" human-panic = "1" -termtree = "0.2.4" +termtree = "0.4" indexmap = "1" git2-ext = "0.0.5" diff --git a/src/bin/git-stack/stack.rs b/src/bin/git-stack/stack.rs index 90b641d..0c7efbc 100644 --- a/src/bin/git-stack/stack.rs +++ b/src/bin/git-stack/stack.rs @@ -1300,7 +1300,7 @@ impl<'r> Tree<'r> { node: Some(self.root), palette, }; - let mut tree = termtree::Tree::root(root).with_glyphs(GLYPHS); + let mut tree = termtree::Tree::new(root).with_glyphs(GLYPHS); let joint = RenderNode { repo, head_branch, @@ -1311,7 +1311,7 @@ impl<'r> Tree<'r> { let stacks_len = self.stacks.len(); for (i, stack) in self.stacks.into_iter().enumerate() { if i < stacks_len - 1 { - let mut stack_tree = termtree::Tree::root(joint).with_glyphs(JOINT_GLYPHS); + let mut stack_tree = termtree::Tree::new(joint).with_glyphs(JOINT_GLYPHS); for child_tree in stack.into_iter() { stack_tree.push(child_tree.into_display( repo, @@ -1325,7 +1325,7 @@ impl<'r> Tree<'r> { let stack_len = stack.len(); for (j, child_tree) in stack.into_iter().enumerate() { if i != 0 && j == 0 { - tree.push(termtree::Tree::root(joint).with_glyphs(SPACE_GLYPHS)); + tree.push(termtree::Tree::new(joint).with_glyphs(SPACE_GLYPHS)); } let child = RenderNode { repo, @@ -1334,11 +1334,11 @@ impl<'r> Tree<'r> { node: Some(child_tree.root), palette, }; - tree.push(termtree::Tree::root(child).with_glyphs(GLYPHS)); + tree.push(termtree::Tree::new(child).with_glyphs(GLYPHS)); if !child_tree.stacks.is_empty() { for child_stack in child_tree.stacks.into_iter() { let mut stack_tree = - termtree::Tree::root(joint).with_glyphs(JOINT_GLYPHS); + termtree::Tree::new(joint).with_glyphs(JOINT_GLYPHS); for child_tree in child_stack.into_iter() { stack_tree.push(child_tree.into_display( repo, @@ -1350,7 +1350,7 @@ impl<'r> Tree<'r> { tree.push(stack_tree); } if j < stack_len { - tree.push(termtree::Tree::root(joint).with_glyphs(SPACE_GLYPHS)); + tree.push(termtree::Tree::new(joint).with_glyphs(SPACE_GLYPHS)); } } } From 2c05360f6402e92ebcc99492e07d49c424a1dc32 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 15 Apr 2022 14:25:00 -0500 Subject: [PATCH 3/3] docs(compare): Add git-machete --- docs/comparison.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/comparison.md b/docs/comparison.md index f20ebd1..3997329 100644 --- a/docs/comparison.md +++ b/docs/comparison.md @@ -64,6 +64,19 @@ Cons: - Only supports Github - Sounds like they require user-prefixes for branches +## `git-machete` + +[Website](https://github.com/VirtusLab/git-machete) + +Pros: +- Supports going up and down stacks (`go up`, `go down`, `go next`, `go prev`, `go root`) +- Quick way to diff a branch on a stack + +Cons: +- Manually managed branch relationships + - `discover` to get started + - `add` to edit the file from the command-line + ## `git spr` [Website](https://github.com/ejoffe/spr)