当前位置:网站首页>Record the idea fallback and the remote library does not

Record the idea fallback and the remote library does not

2021-01-23 22:22:06 HOsystem

  In the use of IDEA Of reset when , The local code will appear, although it's fallback , But the remote codebase did not go back to the corresponding version . In short , The local government is back , The remote library did not fallback . At this time, we need to use the command line operation mode .

1、 stay log Find the version number to recover on

   Use git log View the version number you need to recover to . Get git log version Version number .

  git log

git log


2、 Execute the following command on the client ( Before execution , Switch the local code to the corresponding branch first )

  git reset --hard version Version number

  

git reset --hard xxx Version number

3、 mandatory push To the corresponding remote branch ( If submitted to dev Branch )

  git push -f -u origin dev

  git push -f -u origin dev

  Be careful : Now the code you see on the server has been restored .

   There are two problems with this operation , Although the code on the server has been restored ;

   problem 1: If multiple people are using the same library , Their local version of the code is still higher than the version on the server . If someone else submits the code again , You go back (reset) It's no use operating .

     resolvent 1: Let others delete the local high version branch first , Then pull the branch back from the server .

   problem 2: If multiple people are using the same library , If steps are performed 3 ' mandatory push To the corresponding remote branch ' It will cause the code submitted by others to be deleted . So be careful with coercion push This command ...

     resolvent 2: Use another method , But I didn't meet . So put it first and make it up later . Of course, the best way is to develop without going back , Try to test and submit the code after passing .

版权声明
本文为[HOsystem]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/01/20210123222020701J.html

随机推荐