GIT command record for occasional work

1. GIT command: the remote warehouse is forced to overwrite the local


1、git fetch --all //获取远程仓库所有代码到本地;

2、git reset --hard origin/master //强制将本地代码和远程仓库同步

3、git pull

2. Roll back the code to the cut-off version of the specified time

1. Check the version number

Method A. Use the git log command to obtain the version number, as shown in the figure below, for example, submit the record as of 2022/4/29 18:07:11

 Method B, in IDEA

 2. Roll back the local warehouse, and the remote warehouse has not been rolled back git reset --hard version number

3. git push -f rolls back the remote warehouse

Guess you like

Origin blog.csdn.net/chenyang_wei/article/details/129063572