Should I do either push or pull first?

Viewed 6334

Please imagine this:

My co-worker and I are working on the master branch. I've changed (added and removed) some code. At the same time my co-worker did some changes and pushed a commit to the master branch.

Now my current working directory is different than master branch and I want to keep both the changes on the master branch and my working directory.

What should I do in this case?

If I do a push, the master branch will be the same as my working directory (my co-worker's changes will be gone), If I do a pull first, naturally all my changes will be gone. Anyway, how can I handle such situation?

4 Answers
Related