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
5196
votes
45 answers

How do I squash my last N commits together?

How do I squash my last N commits together into one commit?
markdorison
  • 139,374
  • 27
  • 55
  • 71
4207
votes
19 answers

Undoing a git rebase

How do I easily undo a git rebase? A lengthy manual method is: checkout the commit parent to both of the branches create and checkout a temporary branch cherry-pick all commits by hand reset the faulty rebased branch to point to the temporary…
webmat
  • 58,466
  • 12
  • 54
  • 59
3528
votes
32 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
  • 47,722
  • 9
  • 78
  • 80
837
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
  • 13,571
  • 12
  • 53
  • 78
736
votes
24 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
  • 27,221
  • 34
  • 90
  • 109
669
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
  • 77,385
  • 46
  • 136
  • 148
635
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
  • 30,507
  • 32
  • 137
  • 219
626
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
  • 11,612
  • 10
  • 41
  • 43
594
votes
6 answers

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

I'm trying to understand the difference between a squash and a rebase. As I understand it, one performs a squash when doing a rebase.
GiH
  • 14,006
  • 13
  • 43
  • 56
485
votes
9 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
  • 9,463
  • 9
  • 48
  • 52
430
votes
2 answers

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

I have conflicting branches, feature_x branched from main. Let's say when rebasing feature_x on current main, while resolving conflicts, I decide to take some (not all) of "their" (i.e. main) files as-is. How do I do that? I tried: git checkout…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
360
votes
5 answers

Difference between git pull and git pull --rebase

I started using git sometime back and do not fully understand the intricacies. My basic question here is to find out the difference between a git pull and git pull --rebase , since adding the --rebase option does not seem to do something very…
Rndm
  • 6,710
  • 7
  • 39
  • 58
292
votes
5 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
  • 192,085
  • 135
  • 376
  • 510
283
votes
16 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
  • 77,385
  • 46
  • 136
  • 148
260
votes
11 answers

Git: How to rebase to a specific commit?

I'd like to rebase to a specific commit, not to a HEAD of the other branch: A --- B --- C master \ \-- D topic to A --- B --- C master \ \-- D topic instead of A --- B --- C …
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
1
2 3
99 100