I accidentally committed to a branch that is deleted. I tried pushing and it gave me an error.
How can I create a new branch with the changes I already made?
I accidentally committed to a branch that is deleted. I tried pushing and it gave me an error.
How can I create a new branch with the changes I already made?
hi @Jonathan-Hernandez ! try the following steps:
git checkout <name-of-deleted-branch>
git checkout -b <new-branch-name>
git cherry-pick <commit-hash>
If you have multiple commits that you want to apply to the new branch, you can list them all separated by a space
git push -u origin <new-branch-name>
This will create a new branch with the changes you’ve made