vimagit icon indicating copy to clipboard operation
vimagit copied to clipboard

Feature Request: create and/or checkout branch

Open fpnick opened this issue 8 years ago • 5 comments

Hi Jerome,

I just came across the following: I staged a couple of changes and thought: "Hey, I should open a new feature branch for this". However, that didn't seem to be possible in the Magit buffer, am I correct? So something like "Make this commit to a new branch (instead of the one I'm currently on) and change to that new branch."

That would be a nice feature, I think...

fpnick avatar Aug 03 '17 11:08 fpnick

You're right, it would make a nice feature.

But I disagree the UI you describe. Create a new new branch is not correlated with a commit. It is correlated with checkout.

I think since a long time the best UI to checkout a branch, with completion of existing branches, and a prompt if the requested branch does not exists, asking the user if he wants to create a new branch.

What do you think of such UI?

jreybert avatar Aug 03 '17 12:08 jreybert

That sounds good to me as well. The key point for me would be that I don't have to leave the Magit buffer in order to create the new branch.

What you describe regarding auto completion of existing branches would be a nice add-on, too.

fpnick avatar Aug 03 '17 14:08 fpnick

Current state of thought. Thanks to comment on:

  • default mappings
  • behaviors
  • missing commands

There may be several commands:

  • CBB: prompt the user, asking for branch name. the prompt provides completion. when user types enter, if the branch does not exists, propose to create it (with git checkout -b)
  • CBF: prompt the user, asking for branch name. create this branch at HEAD, even if branch already exists (git checkout -B)
  • CB-: checkout previous branch (like git checkout -)

jreybert avatar Aug 07 '17 16:08 jreybert

Agreed!

What just came to my mind: being able to initiate a merge (e.g. from a hotfix branch back to develop) from Magit would then also come in handy. This should probably be a 'follow-up' issue though.

fpnick avatar Aug 08 '17 07:08 fpnick

Great. I would like a broader audience for the 3 new features (see also #142 and #24 ). If you want to participate, feel free to update the issues, and also discuss it on gitter.

For the merge feature, this is a nice thought. It will be a new feature, but not right now. Handle nicely merge conflict is not that easy.

jreybert avatar Aug 08 '17 09:08 jreybert