Git showing lots of changes and untracked files after checkout

So I’m on a branch, let’s call it feature/PRO-10 and I want to switch to another branch to quickly check the state of a piece of code. I do a git stash to stash my changes and then a git checkout bugfix/PRO-13 to go to the branch I want to look at code on. I finish what I want to do on this branch (without making any changes) and do a git checkout feature/PRO-10 to get back to the branch I was developing on. I’m about to do a git stash pop but wait! There’s a behemoth of modified and untracked files along with other changes.

How did they turn up? I never did any sort of merge. I may have done a git pull to get up-to-date with bugfix/PRO-13 but I don’t see why that would make loads of changes that follow me to my original branch.

  • git merge: PR on master “messed” up my test branch, how do I fix it?
  • What is the relationship between Git and Stash?
  • Does git stash stash all changes or just uncommitted ones
  • Exclude some project settings from version control system like Git, TFS
  • How to get commits information on Jenkins using Groovy since last successful build?
  • Does anyone here fork themself?
  • The worst thing is sometimes I’ll do a git stash pop before doing a git status, meaning I’ll probably have my original changes mixed in with all this other gumph that seemingly came out of nowhere.

    Where are these changes coming from and are they safe to get rid of?

  • Error: fatal loose object ### (stored in .git/objects/… is corrupt)
  • Git cherry pick files, from Directory A to Directory B
  • Push git alias to remote repo
  • Restoring to an old git checkout while keeping attached to a branch
  • retrieve git commit never pushed
  • Can I make git diff only show the changed file names and line numbers?
  • One Solution collect form web for “Git showing lots of changes and untracked files after checkout”

    When you git checkout, git tries to delete the things that don’t exist in the destination branch. If you’ve got a virus scanner running, it’ll leave them behind or prompt you. If you’re confident you have everything either stashed or committed, you can git reset --hard to get rid of these abandoned files. Be careful though as this specifically says “revert all local changes without warning” so make sure that’s really what you wanted to do.

    Git Baby is a git and github fan, let's start git clone.