Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git常用操作 #10

Open
ferstar opened this issue Jan 2, 2020 · 1 comment
Open

Git常用操作 #10

ferstar opened this issue Jan 2, 2020 · 1 comment
Labels
Git

Comments

@ferstar
Copy link
Owner

@ferstar ferstar commented Jan 2, 2020

1. 强行抹掉远程commit log

不小心把不该提交的东西提交了, 可以用这招救命, 团队协作慎用

git reset --hard <需要回退到的commit tag>
git push --force
@ferstar ferstar added the Git label Jan 2, 2020
@ferstar

This comment has been minimized.

Copy link
Owner Author

@ferstar ferstar commented Jan 2, 2020

2. 强制同步远端代码

不小心把本地搞乱, 除了rm and clone again大法外, 还可以这样

git fetch origin master
git reset --hard origin/master
git pull -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.