git-rebase

Allow merging unrelated histories in git rebase

感情迁移 提交于 2019-12-03 02:49:57
When you want to rebase a branch keeping merge commits you pass the --preserve-merges flag. When you are merging unrelated history in git you need to pass the --allow-unrelated-histories flag. If you are doing git rebase --preserve-merges when an existing merge comes from an unrelated history, it fails: fatal: refusing to merge unrelated histories If you try git rebase --preserve-merges --allow-unrelated-histories it fails with: error: unknown option 'allow-unrelated-histories' Is there some other way to tell rebase to allow the merge? Edit: here is a minimal reproduction: https://github.com

Git - Moving Pushed Commits to a Different Branch

老子叫甜甜 提交于 2019-12-03 02:40:46
问题 My boss decided recently to try out an outsourcing group "for increased capacity" as we modify an existing application to add new features. Despite my concern that the group he chose didn't seem to communicate well and wasn't asking enough questions to truly understand and be effective, we went with them anyway. We set them up to collaborate on our Git repository (hosted on GitHub). We created a branch just for them (TheOutsourcedBranch, we'll call it) and requested that they to do all of

Error with git rebase (“could not apply…”)

橙三吉。 提交于 2019-12-03 02:37:08
问题 I'm the administrator of the GitHub repository https://github.com/plison/opendial. I would like to reduce the number of commits on the repository, since the repository already has a few thousand commits, many of whom are minor debugging changes that could easily be squashed together (especially the ones that are a few years old). I'm therefore trying to apply rebasing in order to squash together part of my commits. However, I've experience the following issue: When I type e.g. git rebase -i

Git: best way to remove all changes from a given file for one branch

感情迁移 提交于 2019-12-03 02:29:15
I have a bit of a messy branch with 20 or so commits, and I'm preparing for a merge back to master. I've rebased it off master, and looking closer, I realise that there are files being modified in ways that are totally irrelevant to this branch, and not ready to be committed. The changes to those files aren't confined to specific commits. So basically, I don't want anything to do with those files to be included in this branch if possible. Is there a good way to go about this? My fall back position #1 is obviously to just copy over the latest copy of each of those files then commit. But then

Undoing a git pull --rebase

江枫思渺然 提交于 2019-12-03 01:52:16
问题 Hey I'm new to git and I need to undo a pull, can anyone help?!? So what I've done is... git commit git stash git pull --rebase git stash pop this created a bunch of conflicts and went a bit wrong. Now doing 'git stash list' reveals that my stash is still there. Is it possible to revert my repo back to the point just after doing git commit. So effectively my repo only contains only changes I have made and nothing new from the server? 回答1: using git reflog you will see a list of commits HEAD

How to abort a git rebase from inside vim during interactive editing

…衆ロ難τιáo~ 提交于 2019-12-03 01:43:47
问题 When I do an interactive rebase, e.g. git rebase -i HEAD~3 the rebase interactive editor (vim in my case) opens to let me edit the commits to rebase pick c843ea2 Set Vim column limit to 80 (OS X) pick fc32eac Add Bash alias for `pbcopy` (OS X) .... If I now decide that I want to abort the rebase and quit vim using :q the rebase starts anyway. I'm using git version 1.9.0.msysgit.0 on windows. Sure I can just delete all pick lines, but it might be a lot to do if I rebase a longer history. Is

Aborted old git rebase and lost commits since the rebase started

余生颓废 提交于 2019-12-03 01:37:39
问题 Crap! About a week ago, I was rebasing some commits while trying to clean up my repository, and apparently I didn't actually finish it. Today, a week and several commits later, I went to rebase to reorder a few commits from today, and it told me I was already in the middle of a rebase. That should have been a cue to copy my repo just in case. But I did not...instead I ran git rebase --abort which sounded right at the time. Well, that was not right. It aborted the rebase from a week ago and

Git rebase merge conflict cannot continue

こ雲淡風輕ζ 提交于 2019-12-03 01:17:48
问题 I'm trying to rebase 'dev' to catch up to 'master' branch. $ git checkout dev $ git rebase master First, rewinding head to replay your work on top of it... Applying: Corrected compilation problems that came from conversion from SVN. Using index info to reconstruct a base tree... M src/com/.... <stdin>:125: trailing whitespace. /** <stdin>:126: trailing whitespace. * <stdin>:127: trailing whitespace. */ <stdin>:128: trailing whitespace. package com.... <stdin>:129: trailing whitespace. warning

Git rebase interactive drop vs deleting the commit line

假装没事ソ 提交于 2019-12-02 23:19:29
What is the difference from drop in the Git interactive rebase and just deleting the line of the commit? There is no difference by default, it's just another way to say the same thing. But , if you enable rebase.missingCommitsCheck , then removing a line will trigger a warning (useful to detect if you messed-up a cut-and-paste), while using drop tells Git explicitly that you want to drop the line, and Git won't give any warning. There is in fact another small difference: You can explicitly "drop" all commits. The effect will be the same as a reset. However if you just delete all lines, then

Git branch has diverged after rebase, so why rebase?

拜拜、爱过 提交于 2019-12-02 20:34:54
Recently I came across the notification that my branch has diverged. That was when I made a feature branch, pushed it to remote, and did a rebase with master a few days later when I started working on it again. git checkout -b feature-branch git push origin feature-branch:feature-branch ...and when in master... git pull origin master git checkout feature-branch git rebase master But when I want to push my branch again, it says: On branch feature-branch Your branch and 'origin/feature-branch' have diverged, and have 67 and 1 different commit each, respectively. I found this answer in " Git