0

So. Annoying.

Edited for brevity:

$ git pull origin master
 * branch            master     -> FETCH_HEAD

error: The following untracked working tree files would be overwritten by merge:
    app/models/page.rb
Please move or remove them before you can merge.
Aborting
$ git reset --hard
HEAD is now at d90309f 
$ git pull origin master
 * branch            master     -> FETCH_HEAD

error: The following untracked working tree files would be overwritten by merge:
    app/models/page.rb
Please move or remove them before you can merge.
Aborting

$ git rm --cached
usage: git rm [options] [--] <file>...

    -n, --dry-run         dry run
    -q, --quiet           do not list removed files
    --cached              only remove from the index
    -f, --force           override the up-to-date check
    -r                    allow recursive removal
    --ignore-unmatch      exit with a zero status even if nothing matched

$ git pull origin master
From https://github.com/Jinxy5/laughing-octo-lana
 * branch            master     -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
    app/models/page.rb
Please move or remove them before you can merge.
Aborting
$ git rm --cached app/models/page.rb
fatal: pathspec 'app/models/page.rb' did not match any files

Answers to similar questions state git rm --cached will fix the problems, but am I doing it wrong? Because it says it didn't match any files? Maybe because I ran git reset?

Starkers
  • 9,083
  • 14
  • 82
  • 143

2 Answers2

4

What about this:

git clean -fd
Max Yankov
  • 10,076
  • 10
  • 54
  • 116
1

You must have a look at this post i came up recently to know clearly on removing local changes

Various ways to remove local Git changes

"Conclusion:

It's clear that we can use either

(1) combination of git clean -f and git reset --hard OR

(2) git stash -u to achieve the desired result.

git clean -f -d  "
Community
  • 1
  • 1