git-merge

How do I get git to resolve merge conflicts by putting “ours first, then theirs”

我只是一个虾纸丫 提交于 2019-12-10 21:26:11
问题 I would like to be able to automatically resolve "two branches added blocks at the same line" conflicts by putting the "ours" block first, then the "theirs" block. So instead of a conflict like: 16:09:44 tims@firebat ~/git/merge_conflict_example (master|MERGING) $ cat test.txt good morning good evening <<<<<<< HEAD g'day ======= aloha >>>>>>> branch1 hello hi I'd just get: 16:09:44 tims@firebat ~/git/merge_conflict_example (master) $ cat test.txt good morning good evening g'day aloha hello hi

Git Rebase or Git Merge?

自作多情 提交于 2019-12-10 17:01:49
问题 I have two branches. Both are feature branches - new-ui and video-upload . video-upload is a fork of new-ui . However, video-upload has a TON of commits. I have multiple developers working on new-ui , and one just completed video-upload . But I can't quite figure out which will be the cleaner option to combine the two. I want to bring the completed work in video-upload into new-ui , but I don't know if I want to completely erase all the commits for video-upload and create a new commit history

Merge conflict in a file that wasn't modified in either branch

↘锁芯ラ 提交于 2019-12-10 16:35:47
问题 When I try to rebase branch featureX on master , I get a conflict in a file (let's call it moduleA/foo ) that was not modified in either master or featureX since they diverged! I checked that with the following log command: git log master...featureX -- moduleA/foo and the result was empty (no commit on either branch touched the file since the branches diverged). How is this at all possible and what can I do to avoid such misleading conflicts? 回答1: As @Xlee said, rebase can result on changing

Git merging development branch with master for production versions

只愿长相守 提交于 2019-12-10 13:27:56
问题 I'm using Git for code versioning. I have a development branch on which i'm doing all the dirty development. Every time I publish a production version to the world, I want to put it under my master branch. The problem is that whenever I merge development and master, master receive all development history. I want to keep everything clean so the branches will look like this: development "init commit" "developing" "Version 1.0" "bug fixing" "bug fixing" "Version 1.1" master "Version 1.0"

Git: Default “no commit” merge behaviour for all branches?

会有一股神秘感。 提交于 2019-12-10 13:17:19
问题 I want "git merge" to not commit by default (i.e., I want the "--no-commit" behaviour by default), regardless of the destination branch. I know of "git config branch.master.mergeoptions" for a particular branch, and I know of "git config merge.noff no" for disabling fast-forward on all branches by default. None of the following experiments work for me. Should they? git config branch.mergeoptions --no-commit git config branch.*.mergeoptions --no-commit git config merge.commit no Can't seem to

How to only merge changes added after a certain revision (both ways)?

寵の児 提交于 2019-12-10 12:36:12
问题 Can git merge mostly ignore some file deletions and file renames between two branches, while merging only subsequent changes to the files that were renamed (and ignoring changes to the files that were deleted in one branch), back and forth between the two branches? Thus, I would like to be able to merge changes both ways between two branches. The development branch is initially a copy of the master branch, but with numerous deletions and file renames. This last point is what breaks the method

Transform a combined diff into a patch

☆樱花仙子☆ 提交于 2019-12-10 11:24:15
问题 The git diff manual says... Chunk header format is modified to prevent people from accidentally feeding it to patch -p1. Combined diff format was created for review of merge commit changes, and was not meant for apply. The change is similar to the change in the extended index header... Sometimes it would be nice to feed it to patch though. Is there a way to convert a combined diff into a normal one which is suitable for diff / git apply ? 来源: https://stackoverflow.com/questions/23923830

Merge using EGit results in commit of all changes as done by the merger

笑着哭i 提交于 2019-12-10 10:17:36
问题 I'm using Eclipse with EGit and and my origin/master is on github. On this project are working 3 programmers. When I pull changes to my local git (using EGit) and there are conflicts I solve them, no problem. The thing is that when I commit, it commits a merge that includes all the changed files since my last commit (before pull) and in git I see all these changes by other programmers as if done by me on this last commit of the merge... Why does this happen? What am I doing wrong? Update (14

Can Git merge --squash preserve commit comments?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 10:16:07
问题 Is there a way of automatically adding all the commit comments from the squashed mybranch commits when doing a git merge --squash mybranch so that the single commit contains a concatenation of all the commit comments from mybranch 回答1: I think that's what "git merge --squash" does automatically! Just do the commit with "git commit --no-edit" and I think that's what you'll get. I see all the commit messages inside .git/SQUASH_MSG immediately after I run the "git merge --squash" command. Do you

git - rebase ruins merge

我的梦境 提交于 2019-12-10 04:24:36
问题 I had two branches both independent. I worked on them at various points over a month. I went to merge one branch (let's call it apple ) into the other (let's call it orange ) by checking out orange and doing git merge --no-ff apple and everything went fine. In gitk I could clearly see the branches each had their own history and it was merged together in a merge commit on orange. Later I realize that a commit in orange is incorrect, there is a mistake in the build process, and I must edit that