I finally understand why my code is gone (git)

1. I first created a new branch, which in itself is not right!

The correct approach is, I should have a version of Git log back before then, and then create a new branch after branch push, and then update the code!

 

 

Replay, before I make a mistake is this:

1. I created a new branch (Feature)

2. Then on the new branch (Feature) git log

   git checkout oldversion

3. Then start modifying code, it revised code, I can not push, because a previous version of belonging to belong to detached.

Next, I did a stupid thing, I switched the branch (Feature), the consequences of doing so, I modified the code naturally gone!

 

The correct approach should be:

On the master, first git log, git checkout, then git branch newFeature

Then the first new branch push,

After then modify the code!

Very important

Next, I try

The attempt is successful, and mean it!

Published 217 original articles · won praise 7 · views 50000 +

Guess you like

Origin blog.csdn.net/Hodors/article/details/102739113