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
1 answer

Git rebase onto with mutliple revision sets

We are using git rebase --onto to pick commits from a branch to another branch. Let's say from for simplicity the develop branch to the release branch. 1----A----B----C----D----2----3----E----F---G----H----4----5----6 develop Out of the above I…
MilindaD
  • 7,533
  • 9
  • 43
  • 63
0
votes
1 answer

Avoid merge message in git merge due to past added file

I have a webpage which I've been working on, and have something annoying with git merges which I was wondering if there is a non-rebase workaround for. Essentially the production branch required an additional file to be added to the repository as…
0
votes
1 answer

git branch is in detached from refs/heads/developer

I run the git checkout and once the HEAD was in detached state, I made few commits to in the detached state. Then I created the branch called developer so that all the commits that I did when in detached state came inside my developer…
zilcuanu
  • 3,451
  • 8
  • 52
  • 105
0
votes
1 answer

how to git rebase merge commits on a shared remote branch?

Here is the scenario: There is a remote feature branch called "new_feature_x" and two developers, John and Max. The "new_feature_x" log looks like this: 5:[Max - updated button color] 4:[John - merge commit from master] 3:[John - updated API…
cpprototypes
  • 23
  • 1
  • 3
0
votes
1 answer

Git rebase --skip recovery

I was working in a feature branch named auth+menus, below is the order of events and actions took that I need help trying to recover from. I'm fearing that I have lost all of my work, I hope I'm wrong. git commit -m "code changes" git commit -m…
David Pine
  • 23,787
  • 10
  • 79
  • 107
0
votes
2 answers

git merge or rebase - vastly different master

I had been working on a feature branch for some time now and when I try to merge to master, I notice the master has changes significantly, with some files in my branch have been moved to different folders on master and I have new files in my feature…
0
votes
2 answers

git rebase: weird stash behaviour

I did a git rebase -i, selected one commit for edit and git stopped at that commit. I now try to checkout one patch from the stash with git checkout -p stash. But this gives me weird old stash contents while git stash show -p gives me the…
Oliver Kötter
  • 1,006
  • 11
  • 29
0
votes
1 answer

How to make it so a Git repo starts at a certain commit?

I would like to put an old Git Repo I have for a website publicly on GitHub. I cannot do this because the repo contains the original site and its files as well as the current one. The current one is a complete rewrite of the old site and thus,…
0
votes
2 answers

How to change a very early commit in git?

Suppose I have a couple of commits A-G in my master-branch. Based on commit E, I created two branches branchA and branchB and based on commit F, I created a branch branchC. Suppose I introduced a critical mistake in commit D (on the branch master)…
Max Beikirch
  • 2,053
  • 5
  • 25
  • 36
0
votes
1 answer

git patch management workflow: porting changes from a rebased patch queue branch to a merged feature branch

I'm working on upstreaming some code to qemu, which wants patches sent the the mailing list in small manageable chunks. I therefore have three branches in my git repository: master, tracks upstream. feature, has all my development history,…
ab.
  • 345
  • 2
  • 9
0
votes
1 answer

Why does `git rebase` not show stats?

I've noticed that git pull shows a summary of changed files in the output, but git rebase (or git pull --rebase) doesn't. This seems inconsistent to me. I wonder what's the reason for this behaviour?
planetp
  • 14,248
  • 20
  • 86
  • 160
0
votes
1 answer

Rebase is not just replaying the changes?

From what I understand, rebase replays the commits of the current branch on the target branch. If I understand it correctly, than if I rebase my branch on top of another branch any possible conflicts can occur only on files I have changed, but it…
TCS
  • 5,790
  • 5
  • 54
  • 86
0
votes
1 answer

Simplest way to get rid of commits in git?

I'm trying to use git rebase -i and it's just confusing... What I want to do is keep the exact contents of my current commit, I just want to show the history as if it was the direct descendant of a previous commit. Say I have these commits where I…
Jason Goemaat
  • 28,692
  • 15
  • 86
  • 113
0
votes
1 answer

Git rebase to previous commit gives wrong list of commits

I have a history on my repository like so: Now I want to fix those 3 commits where my partner did not correctly author it, i've done this before using this answer as a guide. So since I want to change those 3, I figured I would rebase at face866,…
Syntactic Fructose
  • 18,936
  • 23
  • 91
  • 177
0
votes
0 answers

Make local point to new git repository

I must say that I am a beginner as far as Git is concerned. I may get a few terminologies and keywords wrong. So, please bear with me. I have 2 different machines with somewhat similar codebase linked to 2 different git repositories respectively. a…
Sagnik Sinha
  • 873
  • 1
  • 11
  • 22
1 2 3
99
100