rebase

Intermingling merge-basing two history tails in Git

我是研究僧i 提交于 2020-01-14 03:13:09
问题 I have two Git repositories with separate histories. After much researching and a lot of tinkering, I wound up with a history that looks like this (using YYYY-DD as pseudo commit-hashes): HEAD---2016-09---2016-08---2016-07---2016-06 \-----2015-10---2015-09 Note that this history appears to have two "roots", as the 2015-10 sequence was merged/grafted into the middle. The important thing is that the files in the 2016-07 history and the 2015-10 history contain completely different files with

git rebase branch with all subbranches

烈酒焚心 提交于 2020-01-12 00:45:19
问题 is it possible to rebase a branch with all it's subbranches in git? i often use branches as quick/mutable tags to mark certain commits. * master * * featureA-finished * * origin/master now i want to rebase -i master onto origin/master , to change/reword the commit featureA-finished^ after git rebase -i --onto origin/master origin/master master , i basically want the history to be: * master * * featureA-finished * (changed/reworded) * origin/master but what i get is: * master * * (same

'Ignore' binary files in git rebase 'theirs'

佐手、 提交于 2020-01-11 10:04:11
问题 I want to go from this A - B - C - D - E - F - G where Branch1 is pointing at E and Branch2 is pointing at G to this: Branch1: A - B - C - D - E \ Branch2: F - G And I want Branch2 to always 'win', I've got as far as this: git rebase -s recursive -X theirs --onto C Branch1 Branch2 That works fine - except that rebase chokes on binary files - saying it can't merge them. How do I go about telling git that I don't want to merge them, I just want to take 'theirs' each time? 回答1: How do I go about

Rebase a merge commit

六月ゝ 毕业季﹏ 提交于 2020-01-10 10:22:13
问题 Suppose my Git repository initially has two branches: Foo and Bar. ... ─ Foo ... ─ Bar I create a third branch, FooBar in which I commit the merge of the two other branches. ... ─ Foo ──┐ FooBar ... ─ Bar ──┘ FooBar is now one commit ahead of both Foo and Bar. Next, I do some more work, committing a few times on Foo only. ... ── A ───┬── B ── C ── D ── Foo FooBar ... ─ Bar ──┘ The question is: since the first parent of branch FooBar is no longer Foo, can I rebase the merge commit in branch

“You are not currently on a branch” error when trying to sync fork with upstream repository

亡梦爱人 提交于 2020-01-06 07:09:54
问题 I made a fork of a GitHub repository. I fixed a bug, wrote a test and created a pull request which was merged into the original repository. So far, so good. Now I improved the test on my local machine. I want to create a new pull request with this improved test. But in the meantime, other commits have been made to the original, upstream repository. So I want to get my fork into sync with the upstream repository so that I can create the new pull request. Without fully grasping what I was doing

“You are not currently on a branch” error when trying to sync fork with upstream repository

£可爱£侵袭症+ 提交于 2020-01-06 07:09:11
问题 I made a fork of a GitHub repository. I fixed a bug, wrote a test and created a pull request which was merged into the original repository. So far, so good. Now I improved the test on my local machine. I want to create a new pull request with this improved test. But in the meantime, other commits have been made to the original, upstream repository. So I want to get my fork into sync with the upstream repository so that I can create the new pull request. Without fully grasping what I was doing

programmatically use git rebase -i

﹥>﹥吖頭↗ 提交于 2020-01-04 05:09:07
问题 I wrote a node module that uses git to make a bunch of commits from time to time. Considering the commits are better if grouped into one single commit, I'd like to use "git rebase -i" to squash them into one. However squashing is only possible in interactive mode, which means I need to manually edit the lines in the editor that pops up when "git rebase -i" is called. I would like to know if it is possible to do this process programatically? So for example when the user calls "save" function

Fatal error with `git rebase upstream-branch` in topic branch

蹲街弑〆低调 提交于 2020-01-03 13:39:13
问题 I have an issue when I try to rebase an upstream branch into a topic branch. The workflow is like this: git checkout upstream git pull origin upstream git checkout topic git rebase upstream The result looks like this: First, rewinding head to replay your work on top of it... Applying Refactored database access and added logging error: patch failed: path/to/file1.ext:21 error: path/to/file1.ext: patch does not apply error: path/to/file2.ext:3 error: path/to/file2.ext: patch does not apply

In my bash prompt, $(__git_ps1) is telling me something is wrong, but what?

一个人想着一个人 提交于 2020-01-03 08:49:08
问题 I've hacked my bash prompt to (in theory) tell me what git branch I'm currently in. But the output indicates that something's wrong: 22:07 (seesaw|REBASE-i) infwb $git branch * master wkg Here's the relevant code in my .bash_profile file (I'll put a larger chunck of it at the end of this question): PS1="$GRAY\$(date +%H:%M)\$(__git_ps1) $GREEN\W$YELLOW \$" As you can see, $(__git_ps1) returns (seesaw|REBASE-i) , even though I no longer have a seesaw branch! (I did have one, and it had a

What to do when new commits happen after a git rebase?

人走茶凉 提交于 2020-01-03 03:03:07
问题 I just got done with a particularly hairy rebase (someone worked for weeks on a branch without ever rebasing.) It took me about two or three hours because the "human readable" format that I was using is just a bunch of IDs and references. While I was doing this rebase, two more commits showed up on the branch before I had the chance to git push the result of the rebase. Is there a best practice for getting those new commits without re-doing the rebase or resorting to a merge? My initial