Tag: rebase

Rebasing onto a repository with no common ancestor

I have a lot of code based on an old version of a source repository (created through git-svn). The usptream has since moved to git and now I need to rebase my code onto the new repository. How do I find a good common point between the repositories (I mean without manually digging through the […]

Switch to hg-flow model: how to rebase commits and branches

I started some time ago a small project and used mercurial as RCS. All commits were done in the default branch, except for one feature branch currently in development in a separate clone of the project. The project became quite important and I’d like to switch to Driessen’s model. I’ve been able to rebase all […]

Auto resolve conflicts in smartgit while rebasing

There is this nice feature in smartgit that sets the conflicted file as the rebase target, which is by invoking the command ‘Set to rebase target (“theirs”)‘ on the file. However, I want this to be done automatically on every conflicted file during rebasing. There are just so many commits and conflicted files that resolving […]

Git – Merging two commits which are not in serial sequence – Commits pushed to remote repo already

I have read about merging two commits that are in a sequence, but how can i merge two commits which are not immediate to each other. Like, my current commit with an old commit Commits are in seq er34rwe commit4 rtt45y5 commit3 iwe8j89 commit2 4E89E8J commit1 now, i would need to merge commit4 with commit2 […]

Rebasing a chain of nonlinear commits with git

I’d like to polish my (messy) feature branch a little before opening a pull request to the original repo. I have around 100 commits that I want to combine into 3 or 4. All commits are already pushed to my own remote repo. As I want to keep the many commits in my own repo, […]

Replace Git history with one commit

I have following repository: * d9da0f2 (HEAD, master) Fifth | * bf3b476 (branch1) branch1 first |/ * 13f93d5 Fourth * 94f2fa1 Third * 5333eb2 Second * be69a71 First All I am trying to do is doing something to it to get the following structure: * d9da0f2 (HEAD, master) Fifth | * bf3b476 (branch1) branch1 first […]

How to squash two commits which are actually before a merge commit?

assume the following history: X – Y – M – Z <- feature / / A – B – C – D <- master I want to rewrite history to fixup X and Y into a single commit. So i want the history look like this: X’ – M’- Z’ <- feature / / A […]

Git change parent commit rev

A colleague of mine checked out commit correct_parent, made some changes based on correct_parent, and then somehow mistakenly committed with another wrong parent commit rev wrong_parent instead of correct_parent (I’m not exactly sure how he managed to do that). Let’s call his commit bad_commit. A whole bunch of new commits are based on bad_commit, including […]

Git merge to a old point in history

I have a small repository, which I try to keep the more linear as possible (only one main branch). At some point in time I introduced breaking change in my code, put a tag at that point and continue. Now, after a lot of commits and push and pull, I needed to extract some stuff […]

Git fails at rebasing in modified commits

We use gerrit for code reviewing. When working with a larger issue, I sometimes send several commits to Gerrit that depend on each other. Here is one such situation, where a, b and c are commits that are awaiting code review in Gerrit: c | b | a | origin/master If I get a comment […]

Git Baby is a git and github fan, let's start git clone.