➜ 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...
➜ demo git:(master)git revert 338bf3e30983d34074f37a18b3ff80ea9bca75f0 删除2.go[master ef822b7]Revert"feat add 2.go"1file changed,9deletions(-)delete mode1006442.go 再次查看 git log : commit ef822b71c33a2dbbdaa350fddcfa14e8fc55e543(HEAD -> master, origin/master)Author: debuginn...
➜ demo git:(master)git revert 338bf3e30983d34074f37a18b3ff80ea9bca75f0 删除2.go[master ef822b7]Revert"feat add 2.go"1file changed,9deletions(-)deletemode1006442.go 再次查看 git log : 代码语言:javascript 复制 commitef822b71c33a2dbbdaa350fddcfa14e8fc55e543(HEAD->master,origin/master)...
git revert HEAD~3 Revert the changes specified by the fourth last commit in HEAD and create a new commit with the reverted changes. git revert -n master~5..master~2 Revert the changes done by commits from the fifth last commit in master (included) to the third last commit in master (...
git revert HEAD~3 Revert the changes specified by the fourth last commit in HEAD and create a new commit with the reverted changes. git revert -n master~5..master~2 Revert the changes done by commits from the fifth last commit in master (included) to the third last commit in master (...
注意:git revert用于记录一些新的提交以还原某些早期提交的效果(通常是一个错误的提交)。 如果你想丢弃工作目录中所有未提交的更改,你应该看到git-reset [1],特别是–hard选项。 如果你想在另一个提交中提取特定文件,你应该看到git-checkout [1],特别是git checkout <commit> - <filename>语法。 请注意这些...
Step 2: Use it to make a newcommit: Let's make a newcommit, where we have "accidentally" deleted a file: Example gitcommit -m"Just a regular update, definitely no accidents here..."[master 16a6f19] Just a regular update, definitely no accidents here... 1 file changed, 0 insertions...
git revert和git reset的区别 先看图: sourceTree中revert译为提交回滚,作用为忽略你指定的版本,然后提交一个新的版本。新的版本中已近删除了你所指定的版本。 reset为重置到这次提交,将内容重置到指定的版本。git reset命令后面是需要加2种参数的:–-hard和–-soft。这条命令默认情况下是-–soft。
git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) model_training.py nothing added to commit but untracked files present (use "git add" to track) Powered By But, we forgot to add the model_training.py script to the commit....
# 1.撤销第5、6次提交L@DESKTOP-T2AI2SU MINGW64 /j/git-repository/revert_test (master)$ git revert 30f7626 d0c8e48[master 31341a4] Revert"Revert "第7次提交,revert 撤销第5、6次提交""1 file changed, 1 insertion(+)[master 509c208] Revert"Revert "第8次提交,revert 撤销第5、6次提交""...