1

We structure our git flow with two main branches: master and develop (which is a branch off master). When creating a new feature for our website, we make a branch from master, make our changes, then merge that branch (call it branch A) into develop for testing.

We have a deploy script in PHP that calls passthu("git pull 2>&1") in order to pull changes onto our development server, which mimics our live server as much as possible. Our development server pulls these changes from the develop branch.

When we're happy with our changes on the development server, we merge branch A into the master branch and run the deploy script on our live server to apply our changes to the live site.

A coworker of mine merged two branches that he had made from master (B into C), and then merged the result into develop. He claims that Github was "acting strangely" after he ran the deploy script on the development server and decided to do a forced push of his own copy of develop in order to return the repository to its previous state.

Now, when trying to run the deploy script from the development server after making new changes and pushing them through our workflow as normal, I'm seeing "Please tell me who you are" and "fatal: empty indent not allowed" errors.

I tried to fix this by creating another script that ran passthru("git reset --soft 2>&1") as this answer recommends, which removed those errors. Now, I'm seeing the following error after making any changes, telling me that git doesn't recognize the files in the repository:

"error: Your local changes to the following files would be overwritten by merge: Please, commit your changes or stash them before you can merge.
Aborting"

Attempting a rebase (git pull --rebase or git rebase -i origin/develop) gives me the same "Please tell me who you are" and "fatal: empty indent not allowed" errors.

I'm leaving a hard reset as a last resort. Is there anything else that I can try first that won't potentially cause major issues with our development site?

sadq3377
  • 827
  • 1
  • 5
  • 17
  • The command `git reset --soft HEAD~N` should execute on a local copy (not development server) and then push to development server by `git push -f`. – Marina Liu Jun 05 '17 at 07:45

1 Answers1

0

Never force the push of a public branch. A force means that the history is rewritten. Is never a good solution. Sometimes a revert is necessary, but acceptable when the developer is one and no-one need same branch.

Now that develop branch is overwritten, all the team member needs to pull the remote develop branch. If the remote is the right one, I suggest to you and all the team members to ...

  • git checkout master
  • git branch -D develop
  • git fetch origin
  • git checkout develop

This sequence will delete local develop branch and will pull the remote one. This is necessary because the develop branch is no more the one all of you have in your local machine.

sensorario
  • 20,262
  • 30
  • 97
  • 159