Desktop with github

I used branch feature/tree-highlight 2 then switch on branch main. After In Desktop github I tryed switch on other branch all stuck, and some files removed. Why it happened ? What did I do wrong? Before I used git stash. I think my github doesn`t work correctly. Maybe need to make some settings?

This sounds like you have changes you haven’t committed on main, but it’s hard to tell.

From the screenshot I see node_modules. This usually is a red flag, as you don’t want to commit anything in node_modules.
This is a common mistake, but one that shouldn’t be overlooked as tracking node_modules means tracking a large amount of files you don’t care about since it isn’t your code.

Add .gitignore and inside of that file add node_modules to the root of your project, this will prevent node_modules from being tracked in the future

However, node_modules will still be tracked in the past. You have 2 choices.

  1. Destroy your .git and github repo, and re-start/re-init your github repo from scratch. Now that you have .gitignore you wont track node_modules.
  2. Delete/revert remove node_modules from your history and current commit. This is usually more complicated and not worth it if your fine removing your pre-existing git history.

This does not look like a github related issue, it’s just a git warning the GUI is showing you to prevent you from losing your work when changing branches. As you may want to keep those changes on main, or bring them to your new branch.

git is a very powerful, but confusing tool at times due to its complexity. Its basically “undo” on massive steroids to the point you’re essentially given a “multi-dimensional time machine”. The GUI will help ease over some of learning that, but the underlying concepts are the same, and the overall power is also the same.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.