Scott Scott - 3 months ago 8
Git Question

Pulling website from git to production

I have a development server which I use for testing what I build on my local system. I made some changes and pushed them to GIT, merged with the "develop" branch then SSH into my develop server and pulled the develop branch in. I keep getting the following error:

error: Your local changes to 'app/Http/Controllers/CheckoutController.php' would be overwritten by merge. Aborting.
Please, commit your changes or stash them before you can merge.

I am not that good with Git, I know the basics and have been using it for a while now. I did a git status in the ssh and all of my changes from the last commits ( which I merged from my local branch to the develop branch within Git ) are listed as if they are not on the develop server ( showing modified, deleted, needs to be added ect. ).

Am I missing a step here? After I merge within GIT I should just be able to do a pull from SSH within the develop server website directory of this project and have it be there I figured.

One other thing, my business partner usually handles GIT. He has set up all projects and usually I just go through the normal motions. He is out of town so im on my own unless I want to wait, which im trying to avoid. So the original setup was in there and working until I started pushing code today.

Any help would be appreciated.

Answer

Git is telling you that app/Http/Controllers/CheckoutController.php has been edited since it was last pulled. Pulling now would overwrite those changes, so git won't let you pull until you decide what to do with that file.

If you want to save the changes and commit them to the tree, git commit on the file and then git push.

If you want to temporarily save the changes and then decide later, run git stash.

If you want to discard the changes to that file, run a git checkout on the file.

Once you do one of these, you will be able to pull again.