Clara
Clara

Reputation: 2715

Git - two different statuses on master

I wasn't very smart when I did this: I worked on my computer on a project - always on master branch with a last commit that I forgot to push to the remote (GitHub).

My computer needed to be repaired and so I cloned the project on another computer (without the last commit) and started working on this one, again working on master only. I pushed the changes to the remote.

But know I can't push from computer 1 because obviously "the remote contains work that you do not have locally".

What is the best way now not to lose any changes? A soft reset and then pushing the changes to a new branch?

Upvotes: 2

Views: 38

Answers (1)

Ry-
Ry-

Reputation: 225281

Pull first on computer 1. It should start a merge.

  • If it merged cleanly, confirm that your code looks the way you want it to.

  • If it didn’t merge cleanly, resolve conflicts so your code looks the way you want it to, then commit the merge.

Then push.

Upvotes: 1

Related Questions