Removing a branch?

Hey y’all, first time posting! I’m not really sure on the best approach to this problem i’m Just kinda stuck on something that gets me worried. I do not want to lose any of our work and want to do this the correct way, any tips, advice, or ideas are welcome.

So when trying to merge mine and a coworkers work in github (i actually use sourcetree), i managed to create a branch that is basically broken. i also somehow managed to get the perfect working commit, the only issue is it keeps asking me to pull the broken branch before i can push the working commit.

i will be creating an entire copy of the project just in case something goes wrong, but id prefer if it didn’t lmao! I’m not sure if i should delete this branch, as there should be nothing of importance on it. or if there is a way to make a specific commit, the “top” commit. or if there is another method i should try. Thanks in advance for any help!

It’s impossible to be sure without seeing the actual messages, but that sounds like the broken branch is set as the upstream of the local branch your “perfect working commit” is on, but you have discarded some of the history (I assume the broken part). By default Git stops when you try to push conflicting history.

If that’s the case you fundamentally have two options:

  • Push to a different branch name.

  • Force-push, which overwrites the remote branch with your local one and discards all commits that are not on your local branch. :warning: