0

I am on branch master. When I do git rebase -i --root master I can see every commit ever made in the repository and rebase. However, when I do a git rebase -i master or a git rebase -i origin/master, I get:

noop

Rebase fa2874e..4a271fe onto fa2874e ( 1 TODO item(s))

When I pick a specific commit to rebase onto, I can rebase, e.g., git rebase -i d0738d9d076cc64565659920b8cf0405fa8f6f4e works.

But in other projects I have worked on, I am positive* that git rebase -i master works without picking a specific commit and shows the delta between all commits on the current branch and master.

What is going on here? Do I have something wrong with remotes?

6
  • 1
    May I ask what do you intend to do when you try to rebase master when the checked out branch also happens to be master? I believe as there isn't any new commit in the new base (master), the operation is expendable - which is probably the reason git labels it as a noop. You may want to try git rebase -i master~n where n is the number of latest commits that you want to change, if that's the objective here. Commented Aug 6, 2015 at 20:32
  • So sometimes in early stage projects that I start, I rewrite master's history before releasing it to other people. For example if I have commits A B C D, where B and C are messy and D kinda fixes everything, I will rebase and squish everything down to make it look like I knew what I was doing from the start. Then people just see A D or maybe even just A. Essentially, I use rebase to make my time series of commits make it look like I knew what should have been done from the start, where in reality I learned what I wanted later. Commented Aug 6, 2015 at 21:37
  • I see. You can probably try git rebase HEAD~3 or git rebase master~4 variations of the command. Commented Aug 7, 2015 at 9:29
  • @NishantShreshth git rebase master~4 works; if you post as an answer I will accept. Commented Aug 12, 2015 at 13:43
  • Alright. But I think I should have included -i in my last comment. Was it not git rebase -i master~4 (with -i flag) that solved your problem? Commented Aug 12, 2015 at 14:05

1 Answer 1

1

Try any of git rebase -i HEAD~n or git rebase -i master~n flavours of the command.

n refers to number of commits that you want to modify.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.