Re: [PATCH] branch: add '-' to delete previous branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 29, 2020 at 12:58:51PM -0600, Taylor Blau wrote:
On Wed, Apr 29, 2020 at 09:01:33PM +0800, Ivan Tham wrote:
Add support to delete previous branch from git checkout/switch to have
feature parity with git switch -.

Signed-off-by: Ivan Tham <pickfire@xxxxxxxxxx>
---
 Documentation/git-branch.txt | 10 ++++++++++
 builtin/branch.c             |  6 +++++-
 t/t3200-branch.sh            |  7 +++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 135206ff4a..37e7cbbc52 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -265,6 +265,10 @@ start-point is either a local or remote-tracking branch.
 	The new branch name must pass all checks defined by
 	linkgit:git-check-ref-format[1].  Some of these checks
 	may restrict the characters allowed in a branch name.
++
+You can use the `@{-N}` syntax to refer to the N-th last branch checked out
+using "git checkout" operation. You may also specify `-` which is synonymous to
+`@{-1}`.

Interesting; we're already using strbuf_branchname, so the first part of
this documentation was true even before this commit. Would you consider
splitting this into two patches?

The first should include the first sentence of this documentation, an
additional test in t3200 exercising an explicit 'git branch -D @{-N}'
for some 'N', but no changes in builtin/branch.c. The second patch would
then make '-' a synonym for '@{-1}'.

Is not this already true? Why do we need to split it? Currently using
'@{-N}' to delete branch already works.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux