[RFC PATCH 0/4] Add alias option to git branch
- Date: Mon, 4 Mar 2019 09:45:45 -0600
- From: Kenneth Cochran <kenneth.cochran101@xxxxxxxxx>
- Subject: [RFC PATCH 0/4] Add alias option to git branch
From c1bad54b29ae1c1d8548d248f6ecaa5959e55f7b Mon Sep 17 00:00:00 2001
From: Kenneth Cochran <kenneth.cochran101@xxxxxxxxx>
Date: Mon, 4 Mar 2019 09:40:22 -0600
Subject: [RFC PATCH 0/4] Add alias option to git branch
Cc: Sahil Dua <sahildua2305@xxxxxxxxx>,
Duy Nguyen <pclouds@xxxxxxxxx>,
Jeff King <peff@xxxxxxxx>
I find myself often using git symbolic-ref to get around work requirements to use branch names that are not very human friendly.
There are a few problems with this:
- There’s a lot of text to type
- Mistyping certain parts (heads/refs) will do things other than create a branch alias
- It will happily overwrite an existing branch
- Deleting one that is checked out will put HEAD in an invalid state.
I think this solution is much better; however, I’m not super familiar with the codebase, so I’m sure it can be improved.
I’d appreciate any feedback.
Kenneth Cochran (4):
branch: add "--alias" option to create an alias
refs: add function to iteratively dereference symref chain
worktree: symref should be found anywhere in chain
branch: disallow accidentally breaking symrefs
Documentation/git-branch.txt | 8 ++++
builtin/branch.c | 49 ++++++++++++++++++++-
refs.c | 28 ++++++++++++
refs.h | 13 ++++++
t/t3207-branch-alias.sh | 83 ++++++++++++++++++++++++++++++++++++
worktree.c | 18 +++++---
6 files changed, 191 insertions(+), 8 deletions(-)
create mode 100755 t/t3207-branch-alias.sh