I have one commit on my branch which has modified 6 files, but when I try git rebase --pull origin main, or just rebase my branch on top of main, I am forced to step through each new commit on main separately. Why is rebase not just prompting to review changes needed on my single commit? How can I avoid reviewing each commit from master interactively?
Asked
Active
Viewed 99 times
0
-
Sounds like you are rebasing the other way around. If your branch is a single revision separate from main and you rebase on main, it should only apply a single revision.... _unless_ somebody messed up main and rewrite its history. Can you show us the commands and their outputs in the question so we can see what's going on? – eftshift0 Sep 06 '22 at 16:01
-
One good way to know what's going on would be to show us the history of both branches. something like `git log --oneline my-branch main`.... at least the few last relevant revisions, not all of the history. – eftshift0 Sep 06 '22 at 16:08
-
2`git log --oneline --graph my-branch main`, sorry. – eftshift0 Sep 06 '22 at 16:21
-
this happened after checking out my branch and running ``` git pull --rebase origin main" – Ali Sep 06 '22 at 16:50
-
Maybe your branch differs from `origin/main` by more commits than you thought? @eftshift0's comment would help here (except I'd use `origin/main` in that command.) Also, `git log origin/main..my-branch` should list only 1 commit if there is only one. – TTT Sep 06 '22 at 18:19
-
1If you discover that you do in fact have more than 1 new commit, it's possible that someone force pushed `main` after you branched off of it. If that's what happened then this would be the answer to your question. (And that would also reinforce why force pushing shared branches is frowned upon.) – TTT Sep 06 '22 at 18:23