git-rebase

Rebasing a Git merge commit

时光总嘲笑我的痴心妄想 提交于 2019-11-26 23:20:54
Take the following case: I have some work in a topic branch and now I'm ready to merge back to master: * eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 I perform the merge from master, resolve the conflicts and now I have: * 8101fe3 Merge branch 'topic' [master] |\ | * b62cae6 2 [topic] * | eb3b733 3 [origin/master] |/ * 38abeae 1 Now, the merge took me some time, so I do another fetch and notice that the remote master branch has new changes: * 8101fe3 Merge branch 'topic' [master] |\ | * b62cae6 2 [topic] | | * e7affba 4 [origin/master] | |/ |/| * | eb3b733 3 |/ *

I can't understand the behaviour of git rebase --onto

对着背影说爱祢 提交于 2019-11-26 21:08:40
I have noticed that the two blocks of following git commands have different behaviours and I don't understand why. I have a A and a B branch that diverge with one commit ---COMMIT--- (A) \ --- (B) I want to rebase B branch on the lastest A (and have the commit on the B branch) ---COMMIT--- (A) \ --- (B) No problem if I do: checkout B rebase A But if I do: checkout B rebase --onto B A It doesn't work at all, nothing happens. I don't understand why the two behaviours are different. Phpstorm git client use the second syntax, and so seems to me completely broken, that's why I ask for this syntax

Git pull.rebase this is a possibly dangerous operation

不羁岁月 提交于 2019-11-26 20:38:24
问题 In the git-config documentation the information about pull.rebase: pull.rebase When true, rebase branches on top of the fetched branch, instead of merging the default branch from the default remote when "git pull" is run. See "branch..rebase" for setting this on a per-branch basis. NOTE: this is a possibly dangerous operation; do not use it unless you understand the implications (see git-rebase(1) for details). Could anybody describe in details what does "NOTE: this is a possibly dangerous

Comparing differences across a rebase in Git

无人久伴 提交于 2019-11-26 19:19:23
问题 Suppose that I just rebased the branch foo on master , with conflicts. I want to make sure that I did not accidentally damage the content of foo during conflict resolution by introducing extra changes or losing changes (other than that which is appropriate for the conflict resolution). I have done this via: diff -u <(git diff `git merge-base master foo@{1}` foo@{1}) \ <(git diff `git merge-base master foo ` foo ) (update: or the equivalent ... syntax for git-diff which I have just been

What's the difference between `git fetch` then `git rebase`, and `git pull --rebase`?

爱⌒轻易说出口 提交于 2019-11-26 18:55:11
问题 In reading the git pull page, it gives this stern warning about git pull --rebase : This is a potentially dangerous mode of operation. It rewrites history, which does not bode well when you published that history already. Do not use this option unless you have read git-rebase(1) carefully. In the git rebase page, it gives a lot of description but no warning of this sort. In addition, I've seen some people say that git fetch git rebase is the same as git pull --rebase while others say they're

git rebase after previous git merge

人走茶凉 提交于 2019-11-26 17:54:23
问题 I have the following situation: I created a clone (Y) from a main repository(X), because there were many people working on Y we didn't do any rebase but only merge s. When we want to deliver( push ) Y to X we would like to do a rebase in order to have things nice and clean The problem is that when doing rebase we are asked to do all the merges that we already did in the previous merge steps. Is there a solution to this, beside the one that means actually re-doing the merges? I expected it to

How do I run git rebase --interactive in non-interactive manner?

*爱你&永不变心* 提交于 2019-11-26 17:26:36
Is it possible to do following? Make git rebase --interactive to just output standard boilerplate to a file, instead to outputting to a file and opening it in editor. Let the user edit the file. Let user re-run git rebase with the name of edited file. Go on with the usual rebase process. Usecase: scripted rebasing of course. See how to re-order commits in Git non-interactively for example. After some thinking and research, the answer turned out to be trivial: git rebase -i takes the editor name from the well-known EDITOR/VISUAL environment variables, so overriding that to point to a non

How to identify conflicting commits by hash during git rebase?

我与影子孤独终老i 提交于 2019-11-26 15:41:16
问题 When I encounter a merge conflict using git rebase , how can I identify the source of the conflict in terms of commits , rather than just file differences? I already know how to make (basic) use of git mergetool or git add before git rebase --continue , but sometimes the differences between files just isn't enough: I want to see the commit log and diff of the commit that just failed to be applied to the working tree. I've read in other questions that git log --merge would show the parent

git rebase basics

点点圈 提交于 2019-11-26 15:39:32
问题 I have started using git rebase recently and am not 100% certain I'm doing it right. For the sake of the question, there are two branches in origin, master and next , which was branched from master . Since last sync between the two, master had 2 commits and next 6: $ git log --oneline origin/next..origin/master 59b5552 master commit #2 485a811 master commit #1 $ git log --oneline origin/master..origin/next 4ebf401 next commit #6 e9b6586 next commit #5 197ada0 next commit #4 4a2c3c6 next

git rebase: “error: cannot stat &#39;file&#39;: Permission denied”

纵然是瞬间 提交于 2019-11-26 15:06:09
问题 I'm using git, and made a small commit followed by a large one. I decided to use git rebase to squash the two commits together before pushing them. (I've never done this before.) So I did: git rebase -i HEAD~2 This gave me my editor, where I chose to pick the earlier commit and squash the later one. When I saved, git said: error: cannot stat ' filename ': Permission denied Could not apply sha1 for later commit ... initial line of text for that commit Now: Neither commit appears when I do git