error: Your local changes to the following files would be overwritten by merge:

782 views
Skip to first unread message

Matthew Noble

unread,
Jan 2, 2015, 3:54:43 PM1/2/15
to moose...@googlegroups.com
Hello, 

I tried to update MOOSE.

I navigated to <projects>, <moose> and then typed "git pull" and the following error message was received:

error: Your local changes to the following files would be overwritten by merge:
modules/phase_field/src/base/PhaseFieldApp.C
Please, commit your changes or stash them before you can merge.
Aborting

I don't understand what this means, can someone please explain it to me and how to solve this?

All the best

Matthew

P Talbot

unread,
Jan 2, 2015, 4:13:42 PM1/2/15
to moose...@googlegroups.com
When you do "git pull" it will try to write changes to your local files; if you've modified them, but haven't committed the changes, it doesn't know how to proceed.

To keep your changes, git add then git commit your changes, then git pull again, as
$git add modules/phase_field/src/base/PhaseFieldApp.C
$git commit -m "<your reason for commit>"
$git pull

Hope this helps!

- Paul Talbot

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at http://groups.google.com/group/moose-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/moose-users/6a54220a-ecb4-4a3e-9b7b-59046743057d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Noble

unread,
Jan 2, 2015, 4:21:28 PM1/2/15
to moose...@googlegroups.com
Thank you Paul, 

I'll give it a go when I log back into my Linux partition.

When you say <your reason for commit>, Is this to tell an external code reviewer or for my own personal notes?

M.

--
You received this message because you are subscribed to a topic in the Google Groups "moose-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/moose-users/XbrQwv_h0yw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to moose-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--


 Matthew W. Noble 
MSc. (Merit) (Ebor), BSc. (Hons) (St And), AMInstP

Postgraduate Researcher at Oriel College, Oxford
DPhil -- Materials Science

Department of Materials 
University of Oxford, 16 Parks Road, Oxford, OX1 3PH

Mobile:
             
07846751826

 

http://fc07.deviantart.net/fs71/i/2012/082/2/e/oriel_college_oxford_coat_of_arms_by_chevrontango-d4tnn0i.jpg

 

Benjamin Spencer

unread,
Jan 2, 2015, 4:22:33 PM1/2/15
to moose-users
Git requires that any changes made to tracked files be committed before pulling.  You have a few options:

1) If you want to throw away your changes, set the files back to how they were before your changes.  This will reset all files in the project:
git reset --hard HEAD
If you want to reset selected files, you can do:
git checkout HEAD -- name_of_file_to_reset

2) Commit your changes.  Commits in git only affect your local project until you push to another project, so you don't need to worry about messing anyone else up with your code that's not ready to publish to the world.  You can modify your commits, so things don't need to finalized to commit.  I usually make a series of incremental commits as I'm working on a feature, and then squash them into a single commit when I'm ready to push it up to my github repository to propose a code change.
git add name_of_modified_file
git commit -m "Commit message"
git pull --rebase upstream devel

3) Stash your changes.  Stashing is a quick way to reset your project back to how it was before your changes, but still save your work.  You can stash, pull down updates, and then apply your stash.
git stash save my_stash_name
git pull --rebase upstream devel
git stash pop

-Ben

Benjamin Spencer
Fuels Modeling and Simulation
Idaho National Laboratory
PO Box 1625
Idaho Falls, ID 83415-3840
208-526-1683

On Fri, Jan 2, 2015 at 1:54 PM, Matthew Noble <matthew.n...@gmail.com> wrote:

--
Reply all
Reply to author
Forward
0 new messages