![]() ![]() Since 52d59cc (" branch: add a -copy (-c) option to go with -move (-m)",, Git v2.15.0-rc0 - merge listed in batch #12) we can copy a branch to make a new branch with the '-c' (copy) option or to overwrite an existing branch using the '-C' (force copy) option.Ī no-op possibility is considered when we are asked to copy a branch to itself, to follow the same no-op introduced for the rename (-M) operation in 3f59481 ( branch: allow a no-op, , Git v1.7.9-rc0 - merge) (branch: allow a no-op "branch -M HEAD", ). (Merged by Junio C Hamano - gitster - in commit 963f8d3, ) branch: force-copy a branch to itself via is a no-op See commit cfbd173 () by Rubén Justo ( rjusto). With Git 2.40 (Q1 2023), ' git branch -c' ( man) is more robust and detects a no-op case. Second part: with git 2.23 (Q3 2019), no need to use git branch or the old confusing git checkout: you have git switch. ![]() Stand, instead, as there no longer is my favourite blue chair).īut if somebody creates a new red chair, modelling it after the blueĬhair I am sitting on, I do not expect to be booted off of the blueĬhair and ending up on sitting on the new red one. If I were sitting on a blue chair, and somebody comes and repaints it to red, I would accept ending up sitting on a chair that is now red (I am also OK to This does not match the usual expectation. It probably was made this way because " git branch -c A B" piggybacked its implementation on " git branch -m A B", When creating a new branch B by copying the branch A that happens toīe the current branch, it also updates HEAD to point at the new Note: when copying a branch, you remain on your current branch.Īs Junio C Hamano explains, the initial implementation of this new feature was modifying HEAD, which was not good: With the branch, and unlike -move keeping the other already-submitted Preserving all the tracking info and other configuration that goes work to work-2 after submitting the work topic to the list, while copying a topic branch to a new version,Į.g. This uses the same underlying machinery as the -move ( -m) optionĮxcept the reflog and configuration is copied instead of being moved. (Merged by Junio C Hamano - gitster - in commit 3b48045, ) branch: add a -copy ( -c) option to go with -move ( -m)Īdd the ability to -copy a branch and its reflog and configuration, See commit 52d59cc, commit 5463caa () by Sahil Dua ( sahildua2305). See commit c8b2cec () by Ævar Arnfjörð Bjarmason ( avar). With Git 2.15 (Q4 2017), " git branch" learned " -c/-C" to create a new branch by copying an existing one. See second part (since Git 2.23, Q3 2019): git switch -c newBranch oldBranch ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |