Questions tagged [git-rebase]

With the git-rebase command, you can take the changes from one branch and replay them on top of another branch.

git rebase allows you to specify the starting point of a branch, that is, to "move" changes from a branch on top of another branch. You can also specify specific commits even if they don't have branches associated with them

The Git book has a chapter on rebasing has some nice examples with diagrams that help to understand the general concept, although each system has different capabilities.

Another common way to integrate changes is to merge to branches. The difference between these two operation has been covered in Stack Overflow:

Also on the usage of git svn the equivalent to git pull is a git svn rebase that rebases local changes ahead of the commits existing in the subversion repository.

A rebase can be undone as explained in "Undoing a rebase"

1640 questions
0
votes
2 answers

Can't reordering commits with rebase -i produce incorrect code at times?

Though haven't tried personally, still my intuition says that reordering commits with git interactive rebase can produce both syntactically and semantically incorrect code at times. The final result may vary if the orders are shuffled. One trivial…
sherlock
  • 2,397
  • 3
  • 27
  • 44
0
votes
2 answers

Sharing edits in shared shared commits in git

Git allows you to edit history of the branch with git rebase -interactive. You can edit some commit, which worth updating for other branches also. How do you update another branch? For instance, I had two branches A=Root <- A1 <- A2 <-A3 and B=Root…
0
votes
1 answer

How to "flat" git history after merge

First of all, I'm sorry for the title. I don't know to describe the issue without a sample. 1. And here is my issues: I have got a history like this : C1-->C2-->C3-->C4-->C8 --> develop | | C5-->C6-->C7 --> feature (this…
Hung Doan
  • 1,167
  • 12
  • 19
0
votes
2 answers

How to know which Git commits to squash in my branch when looking at history

As with many places we like to squash our commits, within our feature branches before merging to master. To do this we frequently squash commits with an interactive rebase (git rebase -i HEAD~10) before merging How do I know which commits to squash…
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
0
votes
1 answer

Git 1 and 1 commit after rebase aborted

So I commited (but not pushed) some of my work and then another colleague pushed his changes. To get his changes I did git pull --rebase Then there was a conflict in one of the files but I figured I better do it when he is around so I did: git…
user2759617
  • 597
  • 1
  • 8
  • 20
0
votes
1 answer

Rewrite git author history for signed commits

I know I can change the author/committer history in git via the provided github script: https://help.github.com/articles/changing-author-info/ This unfortunately does not work, if you have signed commits/merges. It will sort of work, but all commit…
lockdoc
  • 1,539
  • 1
  • 18
  • 31
0
votes
1 answer

Git rebase master on a new branch is giving merge conflicts

Okay, So here it is. I got a lot of merge conflicts when I try to rebase it on my current feature branch. Master was ahead by like a hundred commits, so it was bound to happen. So, What I though was to update origin master from upstream master,…
Quicksillver
  • 197
  • 4
  • 17
0
votes
1 answer

Did 'git rebase -i master' by mistake and unsure of current state

I'm working with a local repo and there are no upstream repos. I had a single branch 'master' in which HEAD referred to the most recent commit. In an attempt to accomplish something* I did a: git rebase -i master which brought up the editor…
Howiecamp
  • 2,981
  • 6
  • 38
  • 59
0
votes
1 answer

``git pull - -rebase` on feature branches

I'm trying to modify slightly my workflow and I need help in understanding two different scenarios. Scenario 1 Using ​git pull - -rebase​ on feature branches to keep them up to date. Normally I would manually rebase but the rebase flag seems like a…
U r s u s
  • 6,680
  • 12
  • 50
  • 88
0
votes
1 answer

Integrating a branch in the middle of another branch

There is a project where versions are managed only with a master branch and tagging. I have to make a hotfix for a specific release and integrate it in the master branch. The problem: The master branch already contains other commits which I don't…
Maximiliano Padulo
  • 1,452
  • 11
  • 22
0
votes
0 answers

How to know which branch a spefic branch was rebased on to

I am using git reflog to get information about branches, as i need to know the name of the branch passed to the command. for example when using git rebase --onto master, I need to know that master branch is used for rebasing. the problem is that…
Mahmoud Adam
  • 5,772
  • 5
  • 41
  • 62
0
votes
1 answer

Move a set of git commits to HEAD

I have a fork on which there are a handful of commits spread out over a couple of years. I want to consolidate them all on the HEAD. This is so that merging from upstream is done as a rebase and the commits will stay at HEAD. Im trying to avoid…
Ivo
  • 535
  • 2
  • 13
0
votes
1 answer

git rebase: only --root shows commits

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…
Tommy
  • 12,588
  • 14
  • 59
  • 110
0
votes
2 answers

How to merge a pull request locally and temporarily

This is based on the git flow methodology where you have a master and develop branch and features are branched from develop with pull requests from features to develop. So I've finished working on a feature branch and I've submitted a pull request…
t0mmyt
  • 493
  • 1
  • 7
  • 14
0
votes
1 answer

Git using rebase to reorder commits not working?

I am trying to reorder my two last commits. I have order like 449b581 latest commit 8aa0c5a commit prior to latest commit and I'm got in to rebase using comand git rebase -i HEAD~2 which leads me to VIM editor with text pick 8aa0c5a commit…
Miki
  • 2,493
  • 2
  • 27
  • 39
1 2 3
99
100