-1

I made some changes to the code and pushed to a new branch.

Then I accidentally added a directory in another directory that is set to be ignored and committed an amendment to my last push.

This is not what I wanted to do. I actually meant to move the files to another directory then do the commit and push.

However, when I went to pull from master to get a clean copy, I found that all these files are now in conflict on my local machine. How do I remove them from git so there isn't this conflict?

eComEvo
  • 11,669
  • 26
  • 89
  • 145

1 Answers1

0

You can remove every un-tracked file doing

git clean -fxd

You could also do afterwards

git reset --hard

Doing both operations will restore your repo in a clean state. So you'll be able to pull again.

However, beware: it will actually deleted un-tracked files, and your un-commited local modification as well. Take a moment to ensure you might not loose important stuff.


Edit to take the comment into account: to put the repo in a clean state on the remote master branch, you can do

git fetch origin
git reset --hard origin/master
gturri
  • 13,807
  • 9
  • 40
  • 57
  • This seems to fix the problem, but then when I do a pull, I'm right back where I started. – eComEvo Aug 16 '14 at 19:40
  • 1
    Slight modification on what you suggest was to issue the commands `git fetch origin` then `git reset --hard origin/master` which resolved my issue. – eComEvo Aug 16 '14 at 20:46
  • Update your answer and I will accept and thanks for pointing me in the right direction! – eComEvo Aug 16 '14 at 21:11