1

I ran into an issue where a change made to a file was reverted back to its original. So, this is the situtation:

  1. Two lines are changed in a file and pushed to remote repository.
  2. Someone somewhere pushed the same file of older version and the updates were lost.

Any idea what could be the scenario this could happen ? We use clone and push and no forks are used.

3
  • 2
    What is the actual source of the two lines in their reverted form appearing in the file whose push overwrote your changes? If the owner of that branch reverted the two lines, then obviously you'd expect this behavior. Commented Oct 28, 2020 at 6:10
  • we both are owners . what I am trying to understand is why the updates were lost? before he could have pushed old version, he should have pulled from remote which had updated code.so, how the changes from remote were replaced by local changes and when pushed, remote repo did not have the updates. Commented Oct 28, 2020 at 7:18
  • 1
    Well, the other person could have manually changed back the two lines. That would definitely explain your observations. Commented Oct 28, 2020 at 8:17

1 Answer 1

1

There are two possible scenarios that I could think of

  1. It's also possible that the other person used the command git push --force. This enables him to overwrite all the other commits made after his last pull.

  2. The other person was able to pull your update, and they were manually changed those 2 lines again.

1
  • can It also be an affect of some other branch with old updates merged to this branch loosing the changes? Commented Oct 29, 2020 at 5:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.