Skip to content

"accidentally committing to master" isn't specific to master; "accidentally commited to wrong branch" doesn't specify that correct branch must be an existing one #178

Description

@dandrake

This issue is a followup to a discussion on Mastodon: https://social.jvns.ca/@b0rk/115640363143354219 (started here: https://mathstodon.xyz/@ddrake/115633967836101201)

Copying my suggestion there:

These two prompts could be a bit more clear, and be improved to show exactly how they are related:

"I accidentally committed something to master that should have been on a brand new branch!"

and

"I accidentally committed to the wrong branch!"

For the first one, it mentions "master" but there's nothing special about accidentally committing to master/main; the workflow there works regardless of which branch you're on -- the only important thing is that you want the commit on a new branch.

The second one is identical to the first -- it doesn't matter which branch you start on -- with one difference: you want the commit on an existing branch.

Maybe the following would make the similarity clearer?

"I accidentally committed to the wrong branch, and want it on a new branch!"

and

"I accidentally committed to the wrong branch, and want it on an existing branch!"

Then make both solutions start with a commit to wrong-branch; in the first, you put that top commit on newly-created-branch, and in the second, you get it on existing-branch.

And for both, it seems like you should mention cherry-pick; that seems to be a bit more idiomatic and safer. (To me, at least...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions