Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
485 views
in Technique[技术] by (71.8m points)

branch - How do I use Git's interactive rebase with a local-only repository (no remote / origin)?

I use git as a local source control system mostly for history and diff tracking. I still want to use rebase to do fixup / squash on WIP commits that I will make periodically. When I try to do git rebase -i though, I get the following:

There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
See git-rebase(1) for details

    git rebase <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=<remote>/<branch> MyBranch

It seems like git doesn't expect you to use interactive rebase without an upstream remote? How do I do that?

question from:https://stackoverflow.com/questions/30625213/how-do-i-use-gits-interactive-rebase-with-a-local-only-repository-no-remote

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

git rebase -i in shorthand, without specifying a destination branch, will make git assume that you are trying to rebase against a remote branch tracked by your branch. That's why the error message is mentioning stuff about remotes.

When you do specify a target, git will rebase against that commit-ish:

git rebase -i <commit-ish>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...