I have a previously not git tracked directory which follows the same folder/file structure as a repo.
It is exactly the same as the repo, apart from some extra files (ignored by .gitignore in the origin repo), as well as a couple of new files.
I did the following to link it up to the origin repo:
git init
git remote add origin [the repo url]
git fetch
git co -b new-branch-to-commit-the-2-new-files-onto
I know I need to pull from origin, so git knows that only these 2 new files are different from the origin repo.
If I try git pull origin master
, I get this message:
"The following untracked working tree files would be overwritten by merge:... Please move or remove them before you merge." - which then lists EVERY file in the project.
If I remove all the files from the directory, I will delete some files which should not be deleted (the ones listed in .gitignore and also the 2 new files).
To summarise, I want to pull and merge master branch into my newly initialised repo. Any files in the origin repo can overwrite what I have locally, but I do not want any local files deleted.
I was hoping the following would have this effect:
git pull origin production -s recursive -X ours
but it gave the same "Please move or remove them before you merge." message.
Thanks