Reputation: 59
So to make a long story short, I've been working on a web app for the past few months. Recently I had to get a new laptop and cloned the repository from github onto my new machine... However whenever I commit changes to my app and attempt to use git push -u
in the app's root directory i get the following message:
To [email protected]:acc/etc.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:acc/etc.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
but when I try git pull [email protected]:acc/etc.git master
I get a message telling me that the pull was aborted.
From github.com:acc/etc
* branch master -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
config/routes.rb
test/fixtures/users.yml
Please, commit your changes or stash them before you can merge.
Aborting
so then i commit my changes using git commit -m 'fixing'
and then attempt git pull
again.
however this time I got messages stating that practically all my files had an "Auto-Merging CONFLICT"
am i totally screwed with this particular repository? I'm not really sure what to do since git is still somewhat new to me....
Upvotes: 2
Views: 225
Reputation: 363797
am i totally screwed with this particular repository?
No, but you will have to do a manual merge, since Git can't figure it out. git status
will tell you which files need editing. The files themselves contain markers indicating where you should edit. When that's done, git push
should work again.
Upvotes: 3
Reputation: 96584
If the changes aren't that big, consider making a copy of the entire folder/project in a different directory outside of the project, then git reset --hard HEAD
will wipe out, erase and delete your recent changes.
You can then apply them again individually using your save3d copies for refernce.
Make sure sure you git add
before git commit
of course.
Finally if you get auto commit merge issues you can always just edit the files manually to resolve.
Upvotes: 2