rebase

How to prevent lot of git conflicts when git rebasing lot of commits?

不打扰是莪最后的温柔 提交于 2019-11-30 10:19:23
问题 Story: in the middle of a project my colleague created a new branch from master and started doing her heavy re-factoring work. I created my branch from master and started doing new stuff on the page. We are committing regularly, but only I can rebase code to master (because colleagues changes are too heavy and cannot be deployed from master yet). Unfortunately some of our work rely on the same files. So after few days of work when she finally wanted to rebase her changes to master , she had a

how to use git rebase to clean up a convoluted history

╄→尐↘猪︶ㄣ 提交于 2019-11-30 08:31:54
问题 After working for several weeks with a half dozen different branches and merges, on both my laptop and work and my desktop at home, my history has gotten a bit convoluted. For example, I just did a fetch, then merged master with origin/master. Now, when I do git show-branches, the output looks like this: ! [login] Changed domain name. ! [master] Merge remote branch 'origin/master' ! [migrate-1.9] Migrating to 1.9.1 on Heroku ! [rebase-master] Merge remote branch 'origin/master' ---- - -

Git rebase will not continue after a delete/modify conflict

好久不见. 提交于 2019-11-30 07:48:29
I'm in the middle of a rebase of my master to a stage branch git checkout stage git rebase master At some time I deleted two files then modified the two files according to GIT. warning: too many files, skipping inexact rename detection CONFLICT (delete/modify): test-recommendation-result.php deleted in HEAD and modified in [Bug] Fix test recommender. Version [Bug] Fix test recommender of test-recommendation-result.php left in tree. CONFLICT (delete/modify): test-recommendation.php deleted in HEAD and modified in [Bug] Fix test recommender. Version [Bug] Fix test recommender of test

git pull --rebase upstream & git push origin rejects non-fast-forward?

北城以北 提交于 2019-11-30 07:18:19
I've implemented classic OSS maintainer/contributor git workflow for a company project on github, however one edge case produces some weird results that I'm not sure how to get around. Lets say there is a typical project that I forked and added upstream remote to keep it up to date. git clone git@github.com:kozhevnikov/<project>.git git remote add upstream git@github.com:<company>/<project>.git For the purposes of this example this fork is behind by a few commits. git reset --hard HEAD~5 && git push --force I work on this fork and push some commits, before pushing my last commit and creating a

Git Rebase seems to have worked but all commits are still showing in the log… what state am I in?

本小妞迷上赌 提交于 2019-11-30 07:14:08
I think I squashed the last 40 commits using rebase. I was following this guide to make sure I didn't do anything stupid - http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html The problem is, I think I did something stupid. The (interactive) text file couldn't be saved, so it seems that the rebase failed but the message it gave and some other things below suggest it might have worked. Not sure where I am or what to do (or even what my name is). Here's what I did: I typed git rebase -i HEAD~40 A text file came up, which I edited, by changing all lines to start with 'squash

Rebase a merge commit

回眸只為那壹抹淺笑 提交于 2019-11-30 06:53:57
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 FooBar to again have Foo and Bar as its two parents? In other words, can I incorporate the development in

How do I resolve a git-svn index mismatch?

亡梦爱人 提交于 2019-11-30 06:37:01
问题 When I did a git svn rebase it stopped at one point saying: Index mismatch: SHA key of a tree != SHA key of another tree. (I come to know that these SHA keys corresponds to a tree and not a commit from git show of the above two sha keys.) re-reading <sha index of a commit in svn/trunk> ... list of files ... fatal: bad object <SHA1 index of the bad object> rev-list -1 <SHA1 index of the bad object> --not <SHA1 index of the revision it was trying to re-read>: command returned error: 128 I am

How to move some changeset to a new branch in mercurial

放肆的年华 提交于 2019-11-30 06:19:19
问题 I want to move a changeset from one branch to another. Basically, I currently have: A -> B -> C -> D # default branch And I want: A # default branch \-> B -> C -> D # some_new_branch Where some_new_branch does not exist yet. I am used to git, so I guess there is a simple "mercurial" way I am missing. 回答1: One way is to export a patch for B,C,D; update to A; branch; apply patch: hg export -o patch B C D hg update A hg branch branchname hg import patch To remove B,C,D from the default branch,

git: Split history of some files into a separate branch

主宰稳场 提交于 2019-11-30 05:04:22
问题 Say I introduced <feature.c> a while ago and now notice it shouldn't have been part of my main branch but rather a branch feature . Is it possible to use e.g. git-filter-branch to automatically move all of <feature.c>'s history out of my main branch into the feature branch? 回答1: It sounds like you're doing something fairly insane! :) That said, I see a few options, none of which are particularly automated. If you've got a ton of commits with that file present, just admit the mistake, make a

How do I use Git's interactive rebase with a local-only repository (no remote / origin)?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 04:17:20
I use git as a local source control system mostly for history and diff tracking. I still want to use rebase to do fixup / squash on WIP commits that I will make periodically. When I try to do git rebase -i though, I get the following: There is no tracking information for the current branch. Please specify which branch you want to rebase against. See git-rebase(1) for details git rebase <branch> If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=<remote>/<branch> MyBranch It seems like git doesn't expect you to use interactive rebase without