0

I'm migrating to Laravel 5 from Laravel 4.2. To do this I've cloned my master branch and made all of my changes in a new feature branch.

I'm now finished with the migration and ready to replace the contents of my master branch with the contents of my new feature branch. I'm pretty weak on git, but I found this SO answer that looks really straightforward: How to replace master branch in git, entirely, from another branch? - here is the short version:

git checkout seotweaks
git merge -s ours master
git checkout master
git merge seotweaks

When I get to the third step and try to checkout the master branch, I get the following error:

The following untracked working tree files would be overwritten by checkout:

with a list of every file in my app/models folder. I don't have any local changes that haven't been committed and pushed to the new feature branch.

I did move that folder as part of the migration, but I can see the referenced files in the source on the new feature branch on bitbucket.

Does anyone see a step I'm missing or know of a different approach that I could take to get this working?

Edit:

git checkout FTW - works fine

git merge -s ours master - works fine

git checkout master fails - please see error below.

Results from git checkout master:

vagrant@homestead:~/Development/memberSherpa$ git checkout master
error: The following untracked working tree files would be overwritten by      checkout:

app/models/Authors.php
app/models/BusinessAct.php
app/models/Contractor.php
app/models/Customer.php
app/models/Dues.php
app/models/Email.php
app/models/Groups.php
app/models/Skill.php
app/models/Txt.php
app/models/User.php
app/models/UserGroup.php

Please move or remove them before you can switch branches.
Aborting

results from git status:

On branch FTW
Your branch is up-to-date with 'username/FTW'.

nothing to commit, working directory clean

Edit 2:

Here is a screen shot from SourceTree that show my commits while upgrading to L5.

I had to make some changes to an API on the master after FTW branch was created (9 commits). Those changes were added to FTW earlier today. I've highlighted the commit that moved the models.

sourceTree

Community
  • 1
  • 1
retrograde
  • 2,979
  • 6
  • 28
  • 54
  • What is the output of `git status --ignored`? – Edward Thomson Jan 26 '16 at 01:38
  • --ignored returns some test uploads, logs and views: storage/framework/views/f652ea5b02e7724ebc3f79ade54848fc It doesn't contain any files from app/models though – retrograde Jan 26 '16 at 02:33
  • Does `.gitignore` differ between the two branches? I'd post the contents of it so we can be absolutely sure there aren't any syntactical errors. – tjbp Jan 26 '16 at 03:34
  • I just ran both git ignores through a diff checker. They are the same, except FTW has app/storage/* and master has app/storage/uploads/* – retrograde Jan 26 '16 at 03:51

1 Answers1

0

git doesn't know these local changes are the same as what already exist in the repo since the local changes are untracked on your current branch. You need to either commit them or reset to a clean commit before merging.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
  • I'm still not sure I understand. I moved the folder but I then committed/pushed those changes to the new branch. I don't have any local files that need committing. Is there a reason they would be listed as untracked changes? Should I git add . ? – retrograde Jan 25 '16 at 22:59
  • Use `git status` to see which files git is complaining about. – Code-Apprentice Jan 25 '16 at 23:31
  • git status: On branch FTW Your branch is up-to-date with 'username/FTW'. nothing to commit, working directory clean – retrograde Jan 26 '16 at 00:00
  • What happens now when you do the merge? If you still have problems, please edit your question to include the results of `git status` when a particular step fails. – Code-Apprentice Jan 26 '16 at 00:05
  • I updated the question with the errors I am receiving. Thanks – retrograde Jan 26 '16 at 00:12
  • Check your `.gitignore` file(s). I'm willing to bet that these files or a directory somewhere in the path are all being ignored in the current commit. – Code-Apprentice Jan 26 '16 at 00:15
  • Unfortunately, that isn't it. I double checked .gitignore and then edited one of the files. The edited file appears when I run git status. – retrograde Jan 26 '16 at 00:21
  • I'm sorry, but I'm stumped. I apologize for assuming this was a noob git question. – Code-Apprentice Jan 26 '16 at 00:33
  • Thanks for the help. I am a git noob for sure. – retrograde Jan 26 '16 at 00:36