在比较它们之间的差异后,如何使用旧的 git 标记更新我当前的主分支?

How can I update my current master branch with an old git tag after comparing diff between them?

我想检查当前主分支和旧 git 标签(比方说,tag1)之间的差异。

检查差异后,我想放弃更改并将 tag1 合并到我的 master 分支中,因为 tag1 目前 运行 在生产中,我希望我的 master 与它一起更新。

我该如何完成这些任务?

您可以使用 git revert,假设 tag1master 分支上的旧提交:

git revert tag1..master

或者您可以使用 git reset (with the --soft option):

git switch master
git branch tmp master
git reset --hard tag1
git reset --soft tmp
git add .
git commit -m "commit tag1 content to master"