简体   繁体   中英

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.

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. 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.

I'm on a mac, and this obscure config change seemed to fix all my woes regarding unstaged changes when there were none.

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. who knows, feel free to comment if you do.

Do you have auto rebase turned on?

look in your ~/.gitconfig or .git/config for

[branch "master"]
  rebase = true

or

[branch]
  autosetuprebase = always

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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