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)

1856 questions
4121
votes
38 answers

Squash my last X commits together using Git

How can I squash my last X commits together into one commit using Git?
markdorison
  • 115,110
  • 27
  • 52
  • 69
3500
votes
18 answers

Undoing a git rebase

Does anybody know how to easily undo a git rebase? The only way that comes to mind is to go at it manually: git checkout the commit parent to both of the branches then create a temp branch from there cherry-pick all commits by hand replace the…
webmat
  • 50,648
  • 12
  • 52
  • 59
2657
votes
25 answers

Git refusing to merge unrelated histories on rebase

During git rebase origin/development the following error message is shown from Git: fatal: refusing to merge unrelated histories Error redoing merge 1234deadbeef1234deadbeef My Git version is 2.9.0. It used to work fine in the previous version.…
Shubham Chaudhary
  • 36,933
  • 9
  • 67
  • 78
615
votes
5 answers

git cherry-pick says "...38c74d is a merge but no -m option was given"

I made some changes in my master branch and want to bring those upstream. When I cherry-pick the following commits. However, I get stuck on fd9f578 where git says: $ git cherry-pick fd9f578 fatal: Commit fd9f57850f6b94b7906e5bbe51a0d75bf638c74d is a…
wufoo
  • 10,915
  • 12
  • 49
  • 78
600
votes
9 answers

Squash the first two commits in Git?

With git rebase --interactive you can squash any number of commits together into a single one. That's all great unless you want to squash commits into the initial commit. That seems impossible to do. Are there any ways to achieve…
kch
  • 71,135
  • 44
  • 128
  • 148
563
votes
4 answers

Change first commit of project with Git?

I want to change something in the first commit of my project with out losing all subsequent commits. Is there any way to do this? I accidentally listed my raw email in a comment within the source code, and I'd like to change it as I'm getting…
Michael
  • 10,456
  • 9
  • 36
  • 42
550
votes
19 answers

How to squash all git commits into one?

How do you squash your entire repository down to the first commit? I can rebase to the first commit, but that would leave me with 2 commits. Is there a way to reference the commit before the first one?
Verhogen
  • 23,861
  • 32
  • 81
  • 109
539
votes
8 answers

What's the difference between 'git merge' and 'git rebase'?

What's the difference between git merge and git rebase?
Daniel Peñalba
  • 27,557
  • 31
  • 124
  • 209
435
votes
4 answers

What is the difference between merge --squash and rebase?

I'm new to git and I'm trying to understand the difference between a squash and a rebase. As I understand it you perform a squash when doing a rebase.
GiH
  • 11,696
  • 13
  • 40
  • 53
380
votes
8 answers

Remove folder and its contents from git/GitHub's history

I was working on a repository on my GitHub account and this is a problem I stumbled upon. Node.js project with a folder with a few npm packages installed The packages were in node_modules folder Added that folder to git repository and pushed the…
Kartik
  • 8,035
  • 8
  • 45
  • 52
373
votes
2 answers

How to get "their" changes in the middle of conflicting Git rebase?

I have conflicting branches, branch2 branched from branch1. Let's say when rebasing branch2 on current branch1, while resolving conflicts, I decide to take some (not all) of "their" (i.e. branch1) files as-is. How do I do that? I tried: git checkout…
Ondra Žižka
  • 36,997
  • 35
  • 184
  • 250
277
votes
4 answers

Can I make fast forwarding be off by default in git?

I can't really ever think of a time when I would use git merge rather than git rebase and not want to have a commit show up. Is there any way to configure git to have fast forwarding off by default? The fact that there's an --ff option would seem…
Jason Baker
  • 171,942
  • 122
  • 354
  • 501
251
votes
15 answers

Insert a commit before the root commit in Git?

I've asked before about how to squash the first two commits in a git repository. While the solutions are rather interesting and not really as mind-warping as some other things in git, they're still a bit of the proverbial bag of hurt if you need to…
kch
  • 71,135
  • 44
  • 128
  • 148
210
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,344
  • 8
  • 55
  • 63
209
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,093
  • 2
  • 13
  • 5
1
2 3
99 100