You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Move unpublished commits on master to new branch #1021
I cannot remember to create a branch first before I start making commits on master. I'll get halfway through whatever edits and I'm like "d'oh! I forgot a branch" so I can either try to remember my cheatsheet list of git commands to get my changes back to a branch, or what I honestly do is ctrl-c, ctrl-v, do a reset --hard, and then (if I'm lucky) create the branch, and then put my changes back.
What I want is something that will take whatever commits I have locally and move those commits to a new branch and leave the remote untouched.
Reacted by William Shepherd and Bernardo A. Dal Corno
We've discussed various ways of addressing this in the past and I think it's a really interesting area for improvement.
I think at the very least we should show a warning when committing straight to master with the option of creating a branch. We've also discussed supporting the scenario you describe of being able to bring commits out of master and resetting it to the origin branch. That path has a whole lot of edge-cases though so I'd really prefer it if we could prevent these "accidents" from happening in the first place.
That said I think we're pretty full for beta and possibly 1.0 as well but this is a great feature that I want for us to get in at some point.
I still want to call this feature "New Branch, Maybe?" and ensure it's pronounced like "Call Me, Maybe?", but this came up at our mini-summit and is an idea we want to revisit. Stay tuned for more details.
As a user, before I accidentally made a bunch of commits on the wrong branch (ex: protected or master), I want the app to warn me and guide my commits to a new branch so that I don't have to use command line magic to get them to a new branch or reset my work and risk losing everything.
Just want to call out that there are a couple use cases here to potentially differentiate:
I'm going to roll #3633 into this issue, as I think there's an opportunity to take a more holistic look at branch protections and understanding people's workflows there.
Activity
saraford commentedon Mar 9, 2017
I need this.
http://ohshitgit.com/#accidental-commit-master
niik commentedon Mar 10, 2017
We've discussed various ways of addressing this in the past and I think it's a really interesting area for improvement.
I think at the very least we should show a warning when committing straight to master with the option of creating a branch. We've also discussed supporting the scenario you describe of being able to bring commits out of master and resetting it to the origin branch. That path has a whole lot of edge-cases though so I'd really prefer it if we could prevent these "accidents" from happening in the first place.
That said I think we're pretty full for beta and possibly 1.0 as well but this is a great feature that I want for us to get in at some point.
[-]Add a button for the scenario "ARGH I forgot to create a branch first!! :sobs:"[/-][+]New Branch, maybe?[/+][-]New Branch, maybe?[/-][+]"New Branch, maybe?" scenario when committing to master[/+][-]"New Branch, maybe?" scenario when committing to master[/-][+]Move unpublished commits on master to new branch[/+]shiftkey commentedon Feb 28, 2018
I still want to call this feature "New Branch, Maybe?" and ensure it's pronounced like "Call Me, Maybe?", but this came up at our mini-summit and is an idea we want to revisit. Stay tuned for more details.
billygriffin commentedon Sep 28, 2018
From @nerdneha in #4647:
Just want to call out that there are a couple use cases here to potentially differentiate:
billygriffin commentedon Feb 11, 2019
I'm going to roll #3633 into this issue, as I think there's an opportunity to take a more holistic look at branch protections and understanding people's workflows there.
billygriffin commentedon Mar 6, 2019
Closing this issue in favor of #7023.