GithubHelp home page GithubHelp logo

Comments (3)

prati0100 avatar prati0100 commented on June 15, 2024

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.

from git-gui.

PhilipOakley avatar PhilipOakley commented on June 15, 2024

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!

from git-gui.

prati0100 avatar prati0100 commented on June 15, 2024

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

from git-gui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.