codesandbox / codesandbox-client

An online IDE for rapid web development
https://codesandbox.io
Other
13.03k stars 2.27k forks source link

Cannot fix merge conflict; Cannot delete a repo #7444

Closed milichev closed 1 year ago

milichev commented 1 year ago

🐛 bug report

Preflight Checklist

Description of the problem

I somehow got a git conflict between the local and remote main branches, which are both 1 commit ahead. Despite the "Protected" red label, the files are editable, but I never commit to the main branch in csb explicitly.

Now, I cannot reset the local branch.

Then I tried to:

  1. Open another branch via the address bar like https://codesandbox.io/p/github/owner/repo/anotherbranch
  2. In the terminal:
    git checkout main
    git reset --hard <remote main sha>
  3. Switch the environment to the main, both via the branch chooser and address bar.
  4. The code is still broken as if I didn't do step 2.

Tried deleting the local branch and fetching it again - same.

Tried deleting the repository from codesandbox dashboard to re-import it again - no effect:

Tried to rename main to master and re-import the repo:

After all, how could I delete the repo completely?

How has this issue affected you? What are you trying to accomplish?

Restore the repo in codesandbox after the merge conflict.

To Reproduce

Link to sandbox: link

Your Environment

Software Name/Version
Сodesandbox online
Browser Chrome Version 110.0.5481.100 (Official Build) (x86_64)
Operating System macOS 13.2.1 (22D68)
JayaKrishnaNamburu commented 1 year ago

@milichev

In the terminal:
git checkout main
git reset --hard <remote main sha>
Switch the environment to the main, both via the branch chooser and address bar.

Each branch VM is isolated instance, So, resetting master in a new URL and changing the branch to main from the branch switcher will not rest the main in your default branch. I will note this, maybe we should highlight this explicitly, the behaviours inside the VM will not reflect changes in any another VM that is running.

I checked your sandbox, and at the moment it seems to not have any conflicts. So, if you are do have any issues with remote branches.

You can try resetting to local with the terminal, for the default branch itself. And not a different VM, or you can use the Reset branch with Remote option on the top menu.

Screenshot 2023-02-22 at 13 47 48

If you still have any issues around the default branch. Please let know, i can help in looking at the behaviour 👍 And we are actually working on removing the protected limitation on the default branches too. So users can pull and push from any branches all the time.

milichev commented 1 year ago

@JayaKrishnaNamburu, thanks for your explanations! Yes, somehow the repo self-cured. I tried to re-login today, and the repo seems clean and working.

Now, I understand a bit about how VMs and branches correlate. F.x. when I git checkout another-branch, the source code and the project structure in the left pane change. Then the interesting begins:

Keep up the great work!

JayaKrishnaNamburu commented 1 year ago

Nice, good to know the explanation helped. Please feel to reach out anytime 😄. The way the repositories or sandboxes works is, single VM instance per branch. So you can have your isolated, front end, backend running, seed data in databases without hurting any other branches 👍