Pergunta

I currently have a private repository on bitbucket which I use for developing my app on my laptop and desktop. On my laptop I started working on a new branch called bootstrap. I cloned it from origin/master. Unfortunately, I forgot to publish my local master first. Not realizing this, I then made 3 commits to the remote. This made the commits to origin/master and the remote does not have the bootstrap branch.

I then tried to push my local master commits, but it tells me I have the 3 incoming commits. I didn't realize all of this until I pulled on my desktop and everything is a mess. I have no idea how to proceed to fix this and I desperately need help.

Foi útil?

Solução

everything is a mess

Then don't touch it.

  • Clone again your repo in another local repo: at least, everything will be reset.
  • add your first local repo as a remote to the second: git remote add first ../firstRepo
  • git fetch first

Then:

  • make your bootstrap branch in that new local repo: git checkout -b bootstrap
  • through a nice log: git log --oneline --graph -all --branches, seek your new commits in remotes/first, and cherry-pick them to your current bootstrap branch.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top