Commit cd90adf
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 1666c12 commit cd90adf
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 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
37 | 51 | | |
38 | 52 | | |
39 | 53 | | |
| |||
817 | 831 | | |
818 | 832 | | |
819 | 833 | | |
| 834 | + | |
820 | 835 | | |
821 | 836 | | |
822 | 837 | | |
823 | 838 | | |
| 839 | + | |
824 | 840 | | |
825 | 841 | | |
826 | 842 | | |
| |||
845 | 861 | | |
846 | 862 | | |
847 | 863 | | |
848 | | - | |
| 864 | + | |
849 | 865 | | |
850 | 866 | | |
851 | 867 | | |
| |||
858 | 874 | | |
859 | 875 | | |
860 | 876 | | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
861 | 883 | | |
862 | 884 | | |
863 | 885 | | |
| |||
| 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