(use "git restore <file>..." to discard changes in working directory) modified: test3.txt no changes added to commit (use "git add" and/or "git commit -a") 可以看到git 提示Changes not staged for commit,也就是现在对test3.txt有修改,修改内容位于工作区,并用红色显示文件名,但是文件没有...
1)使用git restore --staged命令撤销暂存区中文件的修改。 bash L@DESKTOP-T2AI2SU MINGW64 /j/git-repository/learngit (master)$ git restore --staged test.txtL@DESKTOP-T2AI2SU MINGW64 /j/git-repository/learngit (master)$ git statusOn branch masterChanges not stagedforcommit:(use"git add <...
(use "git restore <file>..." to discard changes in working directory) modified: src/main/java/com/example/learnspringboot/LearnspringbootApplication.java no changes added to commit (use "git add" and/or "git commit -a") 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 接下来提交到索引区,接...
6、 git reset [commit]【重置当前分支的指针为指定commit,同时重置暂存区,但工作区保持不变】 7、 git reset --hard [commit]【重置当前分支的HEAD为指定commit,同时重置暂存区和工作区】 8、git reset --keep [commit]【重置当前HEAD为指定commit,但保持暂存区和工作区不变】 9、 git revert [commit]【新...
git log -- <file> //只查看某个文件的commit git log --after="20122-7-1" --before="2022-7-4" //按时间段查询commit after和before可以单独使用 git log --abbrev-commit //以简短的形式打印commit id git log --grep="xxx" //查找包含commit内容的记录 ...
After runninggit reset <pathspec>to update the index entry, you can usegit-restore[1]to check the contents out of the index to the working tree. Alternatively, usinggit-restore[1]and specifying a commit with--source, you can copy the contents of a path out of a commit to the index an...
If you want to extract specific files as they were in another commit, you should see git-restore[1], specifically the --source option. Take care with these alternatives as both will discard uncommitted changes in your working directory. See "Reset, restore and revert" in git[1] for the ...
(use"git reset HEAD <file>..."to unstage)Changes not stagedforcommit:# 修改的文件,但是没有添加到暂存区(use"git add <file>..."to update what will be committed)(use"git restore <file>..."to discard changes in working directory)Untracked files:# 未跟踪的文件(use"git add <file>..."...
#如果不加commit_id,那么git checkout--file_name 表示恢复文件到本地版本库中最新的状态。 如: 代码语言:javascript 复制 $ echo “123”>>hyy.txt $ git add hyy.txt $ echo"1">>hyy.txt $ git status $ git status On branch master Changes to be committed:(use"git restore --staged <file>....
Changes to be committed:(use"git restore --staged <file>..."to unstage)modified:a.txt cherry-pick 给定一个或多个现有提交,应用每个提交引入的更改,为每个提交记录一个新的提交。这需要您的工作树清洁(没有从头提交的修改)。 将已经提交的 commit,复制出新的 commit 应用到分支里 ...