Is anyone else unable to use Interactive Rebase on repositories that don't have a remote?

I made a new remote repository on bitbucket, then cloned it locally.

Made 1 commit and pushed the master branch to remote origin and made sure it's tracking origin/master branch.

Made 5 more commits that I did not push to the remote origin.

Tried interactive rebase. The ui appeared as it should.

I then removed the remote.

Tried interactive rebase again. Got the empty window error.

The command history shows:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree -c sequence.editor='/Applications/SourceTree.app/Contents/Resources/stree_gri' -c core.editor='/Applications/SourceTree.app/Contents/Resources/stree_gri' rebase -i --autosquash 
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> master

...

It seems interactive rebase will only work for repositories that have a remote.

Is that how it should be?

4 answers

I think I am running into this issue as well. Did you ever find out?

This workflow works for me (no remotes needed):

git log

to figure out which commit (SHA or count) you want to consider your base

git branch RebaseFixup HEAD~3

create a temp RebaseFixup (or whatever name) branch from your rebase point.  e.g. you want to rebase from 4 commits ago, doing pick/squash/fixup/etc on the last 3 commits.  Use the SHA instead if you wish.

git rebase -i RebaseFixup

do your rebase

git branch -d RebaseFixup

cleanup the temporary branch

 

If anyone finds a better workflow, please also update the StackOverflow question here: http://stackoverflow.com/questions/30625213/how-do-i-use-gits-interactive-rebase-with-a-local-only-repository-no-remote/30625214#30625214

Turns out this can be simplified to: 

git rebase -i <commit>

am running into the same issue . were you able to resolve this Derek?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

647 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you