KK2491
KK2491

Reputation: 508

Conflicts are not shown during Git rebase

I am facing a weird issue while trying to rebase a branch with master branch. Scenario is as given below:

Could anybody please explain what is going on here. It would be really helpful, as I maybe missing some basics here.

Thank you

Upvotes: 0

Views: 184

Answers (1)

knittl
knittl

Reputation: 265161

git rebase <target> [<source>] will take all commits from source (defaults to your current branch) and copy them one-by-one to the target. If source is fully contained in target (i.e. all commits of source are also in target), then there are no commits to copy. Rebase is effectively a no-op, with the exception of moving the branch label of source to the same commit as target.

Think of it as commits, as shown by git log --oneline --graph source...target (3 dots), not as changes as shown by git diff source target. You can preview the commits that would be rebased by running git log --oneline target..source—if the output is empty, there are no commits to rebase (source is fully contained in target).


If you want to duplicate the commit on master, you have (at least) three options, depending on the exact content of the commits:

  1. cherry pick:

    git checkout master
    git cherry-pick bug_fix_commit
    
  2. reverting the revert:

    git checkout master
    git revert revert_of_bug_fix_commit
    
  3. Instruct rebase to not compute the range of commits automatically, but manually supply the range to copy:

    git rebase --onto master feature_branch^ feature_branch
    

Upvotes: 1

Related Questions