Questions tagged [rebase]

Changing the starting point of a branch in a Version Control System.

An operation in a version control system or a special way of creating a shared library. (In order of the question counts in Stack Overflow)


Version Control Systems

In some source control system (also known as Version Control Systems o ) that support a rebase is one of the ways of integrating the changes of one branch into another by changing the "father" or starting point of a branch.

Git

See .

Darcs

Support it's still in an early status (March 2013)

Mercurial

There is a Rebase Extension for mercurial as noted in "How to do a rebase like git's rebase"

Subversion

There is no rebase support but using merge --reintegrate might be considered as a similar operation as mentioned in "Subversion rebase?" and "Subversion Branch Reintegration v1.5"


Shared Libraries

Creating a shared library to avoid conflicts with other libraries in the usage of virtual memory. (Wikipedia)

2189 questions
257
votes
5 answers

Rebasing a Git merge commit

Take the following case: I have some work in a topic branch and now I'm ready to merge back to master: * eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 I perform the merge from master, resolve the conflicts and now…
jipumarino
  • 2,573
  • 2
  • 15
  • 5
230
votes
9 answers

Combine the first two commits of a Git repository?

Suppose you have a history containing the three commits A, B and C: A-B-C I would like to combine the two commits A and B to one commit AB: AB-C I tried git rebase -i A which opens up my editor with the following contents: pick e97a17b B pick…
Christian
  • 9,914
  • 6
  • 45
  • 52
220
votes
11 answers

Git rebase --continue complains even when all merge conflicts have been resolved

I am facing an issue that I am not sure how to resolve. I did a rebase against master from my branch: git rebase master and got the following error First, rewinding head to replay your work on top of it... Applying: checkstyled. Using index info…
Lucas
  • 2,340
  • 2
  • 15
  • 7
212
votes
6 answers

Change old commit message using `git rebase`

I was trying to edit an old commit message as explained here. The thing is that now, when I try to run rebase -i HEAD~5 it says interactive rebase already started. So then I try: git rebase --continue but got this error: error: Ref refs/heads/master…
Pablo Fernandez
  • 103,170
  • 56
  • 192
  • 232
211
votes
5 answers

Hg: How to do a rebase like git's rebase

In Git I can do this: 1. Start working on new feature: $ git co -b newfeature-123 # (a local feature development branch) do a few commits (M, N, O) master A---B---C \ newfeature-123 M---N---O 2. Pull new changes from upstream…
jpswain
  • 14,642
  • 8
  • 58
  • 63
205
votes
4 answers

git rebase, keeping track of 'local' and 'remote'

When doing a git rebase, I often have difficulty working out what is happening with the 'local' and 'remote' when resolving conflicts. I sometimes have the impression that they swap sides from one commit to the next. This is probably (definitely)…
Benjol
  • 63,995
  • 54
  • 186
  • 268
204
votes
5 answers

Git commits are duplicated in the same branch after doing a rebase

I understand the scenario presented in Pro Git about The Perils of Rebasing. The author basically tells you how to avoid duplicated commits: Do not rebase commits that you have pushed to a public repository. I am going to tell you my particular…
elitalon
  • 9,191
  • 10
  • 50
  • 86
200
votes
3 answers

How do you rebase the current branch's changes on top of changes being merged in?

Okay. If I'm on a branch (say working), and I want to merge in the changes from another branch (say master), then I run the command git-merge master while on the working branch, and the changes get merged in without rebasing the history at all. If I…
Jonathan M Davis
  • 37,181
  • 17
  • 72
  • 102
190
votes
8 answers

git rebase fatal: Needed a single revision

I have a branch of a public repository and I am trying to update my branch with the current commits from the original repository: $ git fetch remote: Counting objects: 24, done. remote: Compressing objects: 100% (20/20), done. remote: Total…
jrlmx2
  • 1,967
  • 2
  • 11
  • 9
171
votes
6 answers

Rebasing remote branches in Git

I am using an intermediate Git repository to mirror a remote SVN repository, from which people can clone and work on. The intermediate repository has its master branch rebased nightly from the upstream SVN, and we are working on feature branches.…
kfb
  • 6,252
  • 6
  • 40
  • 51
169
votes
7 answers

Git: "Cannot 'squash' without a previous commit" error while rebase

I have the following in the to-do text of git rebase -i HEAD~2: pick 56bcce7 Closes #2774 pick e43ceba Lint.py: Replace deprecated link # Rebase 684f917..e43ceba onto 684f917 (2 command(s)) # ... Now, when I try to squash the first one(56bcce7)…
Dawny33
  • 10,543
  • 21
  • 82
  • 134
165
votes
3 answers

Resolving a 'both added' merge conflict in git?

I'm rebasing in git, and one conflict I get is 'both added' - that is, exactly the same filename has been added independently in my branch, and in the branch I'm rebasing on. git status tells me: # Unmerged paths: # (use "git reset HEAD…
Jez
  • 27,951
  • 32
  • 136
  • 233
160
votes
4 answers

Rebase a single Git commit

Is there a way to rebase a single commit from a branch onto another branch? I have this branch structure: -- -- -- -- -- (Master) \ -- -- -- -- -- XX (Feature-branch) All I want to do is to rebase the last commit of…
Kevin Meyer
  • 2,816
  • 4
  • 21
  • 33
158
votes
21 answers

Git push rejected "non-fast-forward"

I am fairly new to git, yet currently using it to manage our code in a team environment. I had some rebasing issues, and I fixed them using: git checkout --ours filename.txt git add filename.txt git rebase --continue Now I wish to push my changes,…
Frankline
  • 40,277
  • 8
  • 44
  • 75
153
votes
5 answers

How can I combine two commits into one commit?

I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit. The command git merge --squash sounds promising, but when I run git merge --squash my terminal just brings up options for the…
Don P
  • 60,113
  • 114
  • 300
  • 432