Commit 9697dec
committed
teach update-ref a "--rename" option
You can rename a branch with "branch -m", but there is no
plumbing mechanism to rename an arbitrary ref. You can
simulate it with:
git update-ref newname oldname &&
git update-ref -d oldname
but that drops the reflog from oldname. This patch instead
allows:
git update-ref --rename oldname newname
Unlike "git branch -m", it does not munge the branch config
(since this plumbing command is purely about refs), nor does
it allow a missing "oldname" to mean an implicit HEAD
(because it is plumbing, and we are better to make the
caller be explicit than risk a surprise).
Signed-off-by: Jeff King <peff@peff.net>1 parent 94f0577 commit 9697dec
2 files changed
Lines changed: 46 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
28 | 42 | | |
29 | 43 | | |
30 | 44 | | |
| |||
759 | 773 | | |
760 | 774 | | |
761 | 775 | | |
| 776 | + | |
762 | 777 | | |
763 | 778 | | |
764 | 779 | | |
765 | 780 | | |
| 781 | + | |
766 | 782 | | |
767 | 783 | | |
768 | 784 | | |
| |||
787 | 803 | | |
788 | 804 | | |
789 | 805 | | |
790 | | - | |
| 806 | + | |
791 | 807 | | |
792 | 808 | | |
793 | 809 | | |
| |||
800 | 816 | | |
801 | 817 | | |
802 | 818 | | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
803 | 825 | | |
804 | 826 | | |
805 | 827 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
424 | 425 | | |
425 | 426 | | |
426 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
427 | 449 | | |
428 | 450 | | |
| 451 | + | |
429 | 452 | | |
430 | 453 | | |
431 | 454 | | |
| |||
0 commit comments