简体   繁体   English

Git,重新定义错误分支的分支

[英]Git, rebasing an incorrectly branched branch

git clone blah
git checkout -b development
git checkout -b bug581
hack hack
git checkout -b bug588
hack hack

oh wait, bug 588 should sprout from development, not 581. 哦等等,bug 588应该从开发中萌芽,而不是581。

git rebase --onto development bug581 bug588

gives me: 给我:

Cannot rebase: You have unstaged changes.
Please commit or stash them.

err, but i dont? 呃,但我不呢? git status shows working directory is clean. git status显示工作目录是干净的。 so lets stash just for giggles. 所以让我们只是为了咯咯笑。

git stash
git rebase --onto development bug581 bug588

ok now it works, but its pulling the history of bug 581 and 588, i just want the history of 588, not what was in 581. 好吧现在它有效,但它拉动了581和588的历史,我只想要588的历史,而不是581的历史。

I'm on a mac, and this obscure config change seemed to fix all my woes regarding unstaged changes when there were none. 我在Mac上,这个模糊的配置更改似乎解决了我没有关于无阶段更改的困境。

git config --global core.trustctime false

I think it's to do with differences between windows file times, linux file times and mac file times. 我认为这与Windows文件时间,linux文件时间和mac文件时间之间的差异有关。 who knows, feel free to comment if you do. 谁知道,如果你这样做,请随时发表评论。

Do you have auto rebase turned on? 你有自动rebase打开?

look in your ~/.gitconfig or .git/config for 查看〜/ .gitconfig或.git / config

[branch "master"]
  rebase = true

or 要么

[branch]
  autosetuprebase = always

第二次执行“hack hack”,是您的非分段更改发生的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM