【问题标题】:How to pull my second last or n'th last push如何拉我的倒数第二次或倒数第二次
【发布时间】:2021-01-06 01:04:07
【问题描述】:

当我运行git log 时,我看到了:

commit d0fa4410393w92ce6ede2ea26fa2fb74z2e5f1bz (HEAD -> notificationControls, origin/notificationControls)
Author: stufezic-dev <ninjahero@gmail.com>
Date:   Sat Sep 19 12:32:45 2020 +0545

    lockscreen controls working, notification updates yet to fix

commit 2e11d85350a741d6992875e949a0a77abbeb8fde (mainadjust, commitBranch)
Author: stufezic-dev <ninjahero@gmail.com>
Date:   Tue Sep 15 23:30:27 2020 +0545

    notification and lockscreen controls using mediaSession: initiated  
  
commit 2e11d85350a741d6992875e949a0a77abbeb8fde (mainadjust, commitBranch)
Author: stufezic-dev <ninjahero@gmail.com>
Date:   Tue Sep 14 23:30:27 2020 +0545

    notification and lockscreen controls using mediaSession: initiated  
  
...

如何提取倒数第​​二个或倒数第三个提交,而不是最新提交?我只知道 1 个命令:git pull master origin,我正在考虑如何提取任何提交而不是最新提交。

【问题讨论】:

  • 通过命令git pull origin master,您将远程主分支上的所有提交拉到您当前的本地银行,现在您想要什么?直到倒数第二个提交并跳过最新的提交?
  • 这实际上是git log 所说的?您是否真的在 24 小时内准确地创建了两次相同的提交?

标签: git git-commit git-pull


【解决方案1】:

git pull origin master 等价于git fetch origin,后跟git merge origin/master。

如果您想在分支中合并 origin/master 以外的其他内容(例如:origin/master 之前的第三次提交),请使用 git fetch 而不是 git pull:

git fetch

# inspect the history
git log --graph origin/master HEAD

# merge whatever commit you want into your branch
git merge eacf32

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-25
    • 1970-01-01
    • 2012-10-12
    • 2014-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-17
    相关资源
    最近更新 更多