Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7066343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:04:16+00:00 2026-05-28T05:04:16+00:00

When I enter: git rebase -i HEAD~3 Instead of getting the last 3 commits,

  • 0

When I enter:

git rebase -i HEAD~3

Instead of getting the last 3 commits, I’m seeing the last 10.

For some reason , where N is the number i pass in , if 2 <= N <= 10 , I see 10 options. if N = 1, i just see the last commit.

This begs 2 questions:
1. Does anyone know why this is happening ?
2. Does anyone know how I can get N to be 3 ? There are a lot of conflicts that are coming up in the further out commits, and I don’t want to work against them.

For a bit of context:
I have a git “feature branch” that is just a patch to allow some legacy code to work on locally on Macs. it addresses a handful of issues on an ancient Drupal installation that is still in production. i’ve been patching that in to develop against locally, then rebasing it out for commits so it can tested on a staging environment. it’s worked fine… until just now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:04:17+00:00Added an answer on May 28, 2026 at 5:04 am

    The key to what you are seeing is the actual behavior of rebase along with the revision specifier ~.
    I got this tree structure and the information on how ~ works from http://schacon.github.com/git/git-rev-parse.html#_specifying_revisions.

    Following this history graph is an illustration, by Jon Loeliger. Both commit nodes B and C are parents of commit node A. Parent commits are ordered left-to-right.:

    G   H   I   J
     \ /     \ /
      D   E   F
       \  |  / \
        \ | /   |
         \|/    |
          B     C
           \   /
            \ /
             A
    

    As the page I sourced indicates, ~ refers to Nth grandparent where the grandparent will be the first parent of any merge. If you were on a branch where HEAD->A and specified HEAD~3 as your revision that would point to G.

    So rebase -i HEAD~3 would say you wanted to interactively rebase all commits from G to A ontop of G. That means you will see ALL the other commits as part of the rebase process, so instead of just D, B, and A, you will A-F and H-J in the rebase list. That would be 8 different commits listed vs. 3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when i enter git status i see something like: C:\cygwin\home\GIT\webapps>git status # On branch
When I use git commit --amend It will enter into a vi window to
I am doing some sample test with git, before i add my actual stuff.
I'm trying to get started using git, but I'm having some troubles right away.
Using Windows XP I accidentally typed git commit -a instead of git commit -am My
This gives a good explanation of squashing multiple commits: http://git-scm.com/book/en/Git-Branching-Rebasing but it does not
My git console: Home@PC /c/rails/konkurranceportalen (master) $ git push heroku master Enter passphrase for
How do I enter an exclamation point into a Git commit message from the
OS: Windows I write $ git commit then # Please enter the commit message
If I sometime forget to enter a comment for a git commit operation, then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.