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撤销文件修改 #19

Open
myheartwillgoon opened this issue Oct 23, 2018 · 0 comments
Open

git撤销文件修改 #19

myheartwillgoon opened this issue Oct 23, 2018 · 0 comments

Comments

@myheartwillgoon
Copy link
Owner

myheartwillgoon commented Oct 23, 2018

从暂存区移除文件.

git reset HEAD file,会保留文件的修改,一般用于分开提交修改.git add file反操作.

放弃文件的修改

未暂存(git add): git checkout --file
已暂存, 未提交: git reset --hard file
已提交: git reset commitId
清除所有未保存的变更,含未跟踪文件: git clean -fd
移除所有已暂存修改,但不移除工作目录中的新文件(未跟踪): git reset --hard commitId
修改提交记录: git rebase
移除之前的工作,但保留提交记录: git revert commitId

@myheartwillgoon myheartwillgoon changed the title git文件恢复操作 git常用操作 Oct 24, 2018
@myheartwillgoon myheartwillgoon changed the title git常用操作 git撤销文件修改 Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant