New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow creation of orphan branches #2030
Comments
I have thought about it in the past, but decided against adding this feature. It would only very rarely be used and so its main effect would be to confuse beginners. I think it's okay to have to drop to the command line once in a while. |
OK, if it's your decision. By the way, there many things that may confuse beginners. My attitude toward some option that I don't understand is either ignore it until I need it or search for information about it. Personally I don't see how existence of some option may be confusing per se, you just don't use it if you don't know what it is.
I've read something different in description of magit:
Anyway, it's not a problem for me to open eshell sometimes. |
You can always add this yourself with |
@npostavs, yeah, in my init file I can do virtually everything. It's also nice when things don't need to be patched to make them do what they might do by default. Thank you for your reply. |
Well "complete" isn't the same as "implement each and every conceivable feature". Also note that Also I plan to improve branching and pushing a lot some time in the future. Unfortunately many users don't seem to be happy with the current feature set. So unhappy in fact, that I will have to make some intermediate changes. But I would like to keep that to a minimum, because I already know it will change again. Maybe when I write "the real thing" (#1485) in a few months, then this can be reconsidered. Closing in favor of that issue. |
This seems more like adding a keybinding then a "patch" to me.
Not really seeing how the publish branch thing (which sounds awesome, by the way) is related to this issue. |
Yeah not really. It's just that I am getting kind of annoyed, that everyone seems to think I have to improve branch/pushing now. I would like to make all changes in the domain at around the same time, on a feature branch, which can be commended on before it is merged to master. This would allow me to avoid adding features now and then later sacrifice them for other, in my opinion more important, features which happen to collide with features added earlier as temporary kludges. But I give up, I am going to add the requested features now, and then later deal with dissatisfied users when/if I remove them again. |
Is that really true? From what I've seen, whenever you say "I'll do this later" the issue opener generally responds with something like "ok, there's no rush". Pretty sure I've never seen someone say "NO, DO IT NOW!!". |
No, but since a lot of people are unhappy about the current implementation, it feels like it. While users who have approached me about this now understand and accept that I want to delay this, other users would show up with similar wishes, up to the point when I finally tackle this on my own schedule. Replying to all those inquiries would be a lot of work and a bit stressful. So I have decided to do something about this now - sorry for Of course all that could have been avoided by delaying the release of (The current branching and pulling implementation was always just intended as an intermediate, and minimal-viable, implementation. It now turns out that it's not good enough for a released implementation.) |
It also occurs to me, that I would probably not have implied otherwise, except in this context: "not adding |
|
Done. |
This doesn't work. |
oh, right, I misunderstood how modified lisp/magit.el
@@ -1358,7 +1358,11 @@ (defun magit-branch-and-checkout (branch start-point &optional args)
(interactive (magit-branch-read-args "Create and checkout branch"))
(if (string-match-p "^stash@{[0-9]+}$" start-point)
(magit-run-git "stash" "branch" branch start-point)
- (magit-call-git "checkout" args "-b" branch start-point)
+ (magit-call-git "checkout" (if (member "--orphan" args)
+ (cl-list* "--orphan" branch
+ (delete "--orphan" args))
+ (cl-list* "-b" branch args))
+ start-point)
(--when-let (and (magit-get-upstream-branch branch)
(magit-get-indirect-upstream-branch start-point))
(magit-call-git "branch" (concat "--set-upstream-to=" it) branch)) |
@npostavs: Thanks for that, not bad. It still asks for a parent branch, but I guess one could put a similar condition in whatever code is doing that. |
I'm okay with adding |
I would advise against adding it to the popup. |
I agree. |
Yeah, most of the things in Could be just (defun magit-branch-orphan (branch start-point &optional args)
"Create and checkout an orphan BRANCH with contents from revision START-POINT.
\n(git checkout [ARGS] --orphan BRANCH START-POINT)."
(interactive (magit-branch-read-args "Create and checkout orphan branch"))
(magit-run-git "checkout" args "--orphan" branch start-point)) |
I've added that command and updated the wiki. |
can it be added to the popup by enabling an option? |
Not an option but a function: https://magit.vc/manual/magit-popup/Customizing-Existing-Popups.html. |
I've done some research before opening the issue, but it seems like currently Magit cannot be used to create an orphan branch. Am I missing something? I've checked the manual and word
orphan
or--orphan
is not mentioned there, thus chances are it's unavailable. I also have searched issues, no luck.Could you please add an option to do
git checkout --orphan my-branch
via magit? Thanks.The text was updated successfully, but these errors were encountered: