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

Why does Git give "Unknown command: pick" during an interactive rebase?

I did: git rebase mybranch --interactive And I edited my rebase-todo file to something like this: pick aec2c2b Add foo method to bar edit 8441f4b Do something slightly wrong pick dabcc80 Do something else correctly But when I told Git to make it…
Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
0
votes
1 answer

How to move "master" label to some point in the past in Git?

I was designing my application and at some point realized, that what I am doing is a separate branch. I was committing my changes into local repository into "master", but not into remote repository. In my VCS log in IntelliJ I see the following…
Dims
  • 47,675
  • 117
  • 331
  • 600
0
votes
1 answer

conflict on a pull request, would like to rebase my branch and try again

I made a mistake in a pull request and created a conflict in one of my files. Rather than follow github's instructions for hand-merging we'd still like to do this via the github UI. Keeps our review workflow consistent that way. What I'd like to…
jkj2000
  • 1,563
  • 4
  • 19
  • 26
0
votes
1 answer

Delete select commits and merge or rebase and add important commits

So i was checking for other solutions but it's not exactly suited for me I'm also dealing with a branch merge git log commit 6d034e1b1f03241b2c660312660ce29acca23f60 Author: ME Date: Thu Jun 30 13:09:08 2016 +0100 text…
segaps
  • 47
  • 6
0
votes
1 answer

Two parallel histories in one git repository - Causing git rebase problems

Explanation: I created a Git repository back on October 15, 2015 so that I would have a sort of code Portfolio for when I go to college in about 2 years. At the moment I am learning how to program with python with the help of Udemy, but once I am…
Alex Lowe
  • 783
  • 3
  • 20
  • 43
0
votes
1 answer

Continuing a rebase after conflict with JGit not working

I'm trying to complete/continue a rebase (after it was stopped by JGit due to conflicts and after I resolved the conflicts and committed the changes) using the JGit library; but the command does not seem to have any effect. The repository remains in…
0
votes
1 answer

How to practice managing (submitting changes, accepting changes, etc.) a repo?

Short and sweet: How can I practice forking a GitHub repo, making changes to both the forked and original repo, submitting a pull request, merging the changes, rebasing, etc.? More details: The difficulty is that you cannot fork your own repo on…
JohnA
  • 321
  • 2
  • 11
0
votes
1 answer

Git interactive rebase - any way to instruct git to resolve conflicts keeping the HEAD version?

Tried variations of git rebase -i -Xours master but still conflicts are shown and I have to resolve them manually. Plus it's not entirely clear what happens with non conflicting changes in the case of a conflicting commit - are those kept ? Use…
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
0
votes
1 answer

Git remove remote commits

Okay I started out a new angular module (call it radio) by mirror cloning another module (contact list) ... Bad mistake because now, I have tags, branches and commits that have nothing to do with the "new" module ... Please see the image. I managed…
T M
  • 516
  • 5
  • 18
0
votes
1 answer

How to rewrite a whole git history (squashing and rewording) without falling in conflicts?

I am working on code base that has about 5000 commits (including merges). I started interactive rebase to squash similar commits and reword weak commit messages. Before that I deleted some big files following this article. Yet, I have conflicts…
Assem
  • 11,574
  • 5
  • 59
  • 97
0
votes
0 answers

Rewriting git common history on one or more topic branches

I've encountered a workflow on a new team I'm a little unfamiliar with. The goal for most pull/merge requests is to have a single, squashed commit, in an effort to have a clean history. That is fine and well, as usually the squash commits occur once…
jahsome
  • 881
  • 8
  • 18
0
votes
1 answer

Git Rebase Interactive previewer program

Say for instance, I run git rebase -i HEAD~6 then inside the interactive file I have p hash1 comment1 r hash2 comment2 f hash3 comment3 f hash4 comment4 f hash5 comment5 p hash6 comment6 and then I save and exit. Git then applies the commits…
Ryu S.
  • 1,538
  • 2
  • 22
  • 41
0
votes
1 answer

Does the commit reorder change other following commits?

Well, I've made some stupid thing and I didn't add .idea folder to gitignore. Now I have 10 commits with this .idea rubbish and one, the last commit, which consciously adds .idea to gitignore. So, I'm trying to find a solution to clear all the…
Jakov
  • 151
  • 13
0
votes
2 answers

Git: local branch changes not applied when rebasing on master

E.g. I have a feature branch based on master with 1 new commit with 2 added files. commit hash1 A test.html A test.png Now I want to rebase this feature branch on master to get the latest code. Since I started working on feature branch 1 new commit…
Vladimir Tsyupko
  • 163
  • 2
  • 17
0
votes
1 answer

Move multiple non-consecutive commits to different branch

I've got two branches which shouldn't be directly merged together (yet). However, I need to move two different non-consecutive commits from one branch to the other. I currently have: top-branch: A-B-C-D bottom-branch: X-Y And I want to…
JSBձոգչ
  • 40,684
  • 18
  • 101
  • 169