➜ demo git:(master) git revert 338bf3e30983d34074f37a18b3ff80ea9bca75f0删除 2.go[master ef822b7] Revert "feat add 2.go"1file changed, 9 deletions(-) delete mode 1006442.go 再次查看 git log :commit ef822b71c33a2dbbdaa350fddcfa14e8fc55e543 (HEAD -> master, origin/master)Autho...
就算hard模式删除了,其实也没关系,可以使用git reflog查看之前的操作记录,根据commit ID,还能找到之前的版本。前提是别把文件夹给删除了。$ git reflogc40253a (HEAD -> master) HEAD@{0}: reset: moving to c40253ac3d0f4b HEAD@{1}: commit: update file01c40253a (HEAD -> master) HEAD@{2}: ...
git status#--soft回滚到版本号为Agit reset --soft bd39d33#git statusOn branch master Changes to be committed: (use"git restore --staged <file>..."to unstage) new file: b.txt new file: reset1.txt Untracked files: (use"git add <file>..."to includeinwhat will be committed) reset....
1:git reset –mixed:此为默认方式,不带任何参数的git reset,即时这种方式,它回退到某个版本,只保留源码,回退commit和index信息 2:git reset –soft:回退到某个版本,只回退了commit的信息,不会恢复到index file一级。如果还要提交,直接commit即可 3:git reset –hard:彻底回退到某个版本,本地的源码也会变为上...
$ git commit-am'修改 hello.php 文件'[master760f74d]修改hello.php文件1file changed,1insertion(+)$ git statusOnbranch master nothing to commit,working directory clean 简而言之,执行 git reset HEAD 以取消之前 git add 添加,但不希望包含在下一提交快照中的缓存。
Git 提供了git reflog命令,用来记录你的每一次命令: 代码语言:javascript 复制 $ git reflog e475afcHEAD@{1}:reset:moving toHEAD^1094adb(HEAD->master)HEAD@{2}:commit:appendGPLe475afcHEAD@{3}:commit:add distributed eaadf4eHEAD@{4}:commit(initial):wrote a readme file...
git reset[-q] [--pathspec-from-file=<文件> [--pathspec-file-nul]] [<目录树对象>] 这些形式将所有匹配<路径规范>的路径的索引条目重置为<目录树对象>时的状态。 (它不会影响工作目录树或当前分支。) 这意味着,git reset <pathspec>与git add <pathspec>相反。该命令等同于git restore [--source=<...
On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: test.txt 这一次进行第二种操作,执行`git restore --staged test.txt`,然后再执行`git status`结果如下: On branch master Changes not staged for commit: ...
git-reset - Reset current HEAD to the specified state SYNOPSIS git reset[-q] [<tree-ish>] [--] <pathspec>…git reset[-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]git reset(--patch | -p) [<tree-ish>] [--] [<pathspec>…]git reset[--soft ...
(use "git restore --staged <file>..." to unstage) modified: src/main/java/com/example/learnspringboot/LearnspringbootApplication.java 1. 2. 3. 4. 5. 6. 7. 8. 然后reset(默认是mixed),会重置索引区保留工作目录,所以提示中有Unstaged changes after reset,重置后与提交到索引区之前完全一样。