Skip to content
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

Equivalent of git checkout -b <newname> is not obvious. #56

Open
PhilipOakley opened this issue Apr 23, 2021 · 3 comments
Open

Equivalent of git checkout -b <newname> is not obvious. #56

PhilipOakley opened this issue Apr 23, 2021 · 3 comments

Comments

@PhilipOakley
Copy link

It's quite common for people (self included) to checkout some commit (detached head) or branch (named head) and do some investigation resulting in changes that later they want to be a new branch.

Unfortunately there is a bit of a conceptual merry-go-round (with web questions to match) about which commands to use to update the current head to the users chosen new name, and retain the current changes to the working tree. (Clue it's not the branch command).

It's not clear in the GUI which of the branch commands (branch>>create, or branch>>checkout) should be used to achieve this oft required action.

Can we improve the GUI menu scheme and dialog boxes to make the correct action clearer (esp if the user is on the wrong track)?

I haven't investigated the code yet to see which is the right gui option, but the menus didn't help.

@prati0100
Copy link
Owner

It's quite common for people (self included) to checkout some commit (detached head) or branch (named head) and do some investigation resulting in changes that later they want to be a new branch.

Unfortunately there is a bit of a conceptual merry-go-round (with web questions to match) about which commands to use to update the current head to the users chosen new name, and retain the current changes to the working tree. (Clue it's not the branch command).

I'm not 100% sure I understand you here. I assume you mean that git checkout -b new_name is the right way to go about it, and not git branch new_branch. Beginners might think the latter is the right one and might get confused. Am I on the right track?

It's not clear in the GUI which of the branch commands (branch>>create, or branch>>checkout) should be used to achieve this oft required action.

Can we improve the GUI menu scheme and dialog boxes to make the correct action clearer (esp if the user is on the wrong track)?

I haven't investigated the code yet to see which is the right gui option, but the menus didn't help.

When I open branch -> create, I see there is a checkbox at the bottom with the label "Checkout after creation". That should do what you want. So the feature is clearly there. But I see that this is quite the opposite of what the command line Git does. There, "checkout" is used to do this, and here "branch" is used to do this. So are you suggesting that the checkout dialog get a new "create a branch when checking out" option?

I haven't taken a look at the code to see how easy/difficult it would be. FWIW I'm not entirely sure if we should duplicate the feature in two places.

@PhilipOakley
Copy link
Author

It's quite common for people (self included) to checkout some commit (detached head) or branch (named head) and do some investigation resulting in changes that later they want to be a new branch.
Unfortunately there is a bit of a conceptual merry-go-round (with web questions to match) about which commands to use to update the current head to the users chosen new name, and retain the current changes to the working tree. (Clue it's not the branch command).

I'm not 100% sure I understand you here. I assume you mean that git checkout -b new_name is the right way to go about it, and not git branch new_branch. Beginners might think the latter is the right one and might get confused. Am I on the right track?

Correct. The user wants to create a new branch, keeping the current workspace code intact - they already have the code they want 'checked out' and don't want git to change any of their files, just the HEAD and branch pointers.

In my case I was on a detached head and had tried out a few things then thought "this is worth saving, I'll need a branch.."

It's not clear in the GUI which of the branch commands (branch>>create, or branch>>checkout) should be used to achieve this oft required action.
Can we improve the GUI menu scheme and dialog boxes to make the correct action clearer (esp if the user is on the wrong track)?
I haven't investigated the code yet to see which is the right gui option, but the menus didn't help.

When I open branch -> create, I see there is a checkbox at the bottom with the label "Checkout after creation". That should do what you want.

hopefully.. (not tried). But usually most cli commands end up saying to stash current changes which isn't what

So the feature is clearly there. But I see that this is quite the opposite of what the command line Git does. There, "checkout" is used to do this, and here "branch" is used to do this. So are you suggesting that the checkout dialog get a new "create a branch when checking out" option?

Assuming that dialog actually does the business, the main issue, for me, is that the dialog text isn't clear enough about what it does (i.e. that no changes will be made to working files!).

If the dialog does some other command (I'm still to look at the code), then again add a few clarifying words as to what happens to file changes.

I haven't taken a look at the code to see how easy/difficult it would be. FWIW I'm not entirely sure if we should duplicate the feature in two places.

Maybe, assuming 'duplication', then it's simply a dialog that tells the user to look at the checkout menu option, and not the branch menu option!

@prati0100
Copy link
Owner

Ok, I'll take a look when I get the chance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants