gpt4 book ai didi

git rebase : "Could not apply (hash)." I'm lost

转载 作者:太空狗 更新时间:2023-10-29 13:38:15 26 4
gpt4 key购买 nike

我被要求“将(我的)提交 rebase 并压缩成一个提交?”对于 pull 请求 https://github.com/samtools/htsjdk/pull/34#issuecomment-45226559

这是我第一次这样做,我认为我只会做错事。我现在迷路了。

我上次尝试的时候:

$ git branch
* fastq
$ git status
$ git merge-base fastq master
67901f963470a1cd2f8477f736b6b2192343485c
$ git rebase --interactive 67901f963470a1cd2f8477f736b6b2192343485c

(... tried things, ... pulled, pushed, etc...)

$ git rebase --continue
error: Ref refs/heads/fastq is at a3aa885e4943279a7ece9e2eae85b1a80c41af32 but expected c5dc7c69108d1d72cf9eeb0144332075b06fea71
fatal: Cannot lock the ref 'refs/heads/fastq'.

应该怎样做才能满足审稿人的需求?

更新:当我尝试推送时

$ git push origin fastq
To https://github.com/lindenb/htsjdk.git
! [rejected] fastq -> fastq (non-fast-forward)
error: failed to push some refs to 'https://github.com/lindenb/htsjdk.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.

最佳答案

关于 your fasq branch 中的 rebase ,那就是:

git checkout fastq
git rebase -i 67901f963470a1cd2f8477f736b6b2192343485c (last commmit before your change)

# select s for each commmit in order to squash them)

一旦你的提交被 rebase /压缩,你将不得不强制推送你的分支,因为历史是不同的。

git checkout fastq
git push -f

这将自动更新 PR( pull 请求)。

关于git rebase : "Could not apply (hash)." I'm lost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24076641/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com