开发者

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


The second time you do "hack hack", is where your unstaged changes occurred.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜