git-merge

What exactly does cause merge conflict in git?

那年仲夏 提交于 2019-12-08 11:50:27
问题 I wonder when exactly a merge conflict occurs. My assumption is that it occurs when a file was modified in both branches. In more details, if a file was modified in one branch but not in another one, the "modified" version will be used (the "old" version is replaced by a "new" one). If there are two "new" versions (coming from two branches), git does not know what version to use, so a manual merge is required. However, I am not sure about my understanding. I can imagine that even if the same

will fetch/merge not work if files are added or deleted in GitHub repository?

血红的双手。 提交于 2019-12-08 11:19:40
问题 I made two changes to my remote repository in GitHub , by adding a new file and deleting a old file (by using the Web interface of GitHub ). when I do : git fetch origin master remote: Counting objects: 6, done. remote: Compressing objects: 100% (4/4), done. remote: Total 5 (delta 2), reused 0 (delta 0) Unpacking objects: 100% (5/5), done. From github.com:TommyHilly/programFiles * branch master -> FETCH_HEAD git merge origin/master Already up-to-date. whenever new files are added or deleted,

How to make Git understand that moved file and edited file is the same file?

*爱你&永不变心* 提交于 2019-12-08 07:56:47
问题 I have 2 branches. In first file named index.html is edited and commited. In second this file edited and moved to other folder. Can I make GIT understand (while merging) that index.html from 1st branch is the same file "folder/index.html" form second branch. In my opinion the problem is that when I moved file into a new folder GIT first deleted it and then created it in new folder. So after merging I will have 1 file with both changes? 回答1: Git should already know they are the same file. See

Git Workflow, Nvie Branching Model Ahead and Behind

北慕城南 提交于 2019-12-08 07:33:12
问题 Following Nvie's git branching model, why do I end up with 'develop' and 'master' each 1 ahead and 1 behind the other after merging the same 'release' branch into both? If the same 'release' branch is merged into each, shouldn't master and develop agree? x 84a628d (origin/develop, develop) Merge branch 'release-v3.0.1' into develop |\ | | x 2e4d60b (HEAD, v3.0.1, origin/master, master) Merge branch 'release-v3.0.1' | | |\ | | |/ | |/| | x | 716ce96 (release-v3.0.1) Version 3.0.1 |/ / x |

Git Merge branch 'master' of https://bitbucket.org/xxx/yyy

假装没事ソ 提交于 2019-12-08 07:33:07
问题 We have come to git after using SVN for years and at times, I must admit, it is confusing. Take the following example - User1 makes a change to a.java and pushes to the remote server. User2 makes a change to b.java. He can't push straight away (a deviation from SVN but that is OK). He needs to first pull from remote server, and then push his change to the remote server. This would be shown as a separate merge commit and has been beautifully explained in here on stackoverflow itself Now is the

.gitattributes merge driver is not used

為{幸葍}努か 提交于 2019-12-08 06:57:01
问题 At first, I know this question How do I tell git to always select my local version for conflicted merges on a specific file? but this post doesn't help me and I can't add any comments because of my reputation. http://git-scm.com/book/en/Customizing-Git-Git-Attributes suggests to set the merge strategy to ours for the path instead of setting a custom merge driver. What is the benefit and differene of adding a custom merge driver return an exit code 0? I have a .gitattributes file on my repos

Three commit references when merging submodules

允我心安 提交于 2019-12-08 06:26:13
问题 I am merging a branch in a project that uses git submodules. Usually when there is a conflict there are two sets of changes, theirs and ours. Resolving the conflicts is about merging these two into one. But I noticed that for git submodules the diff shows a third value: diff --cc my_submodule index dd7404e,e6753b1..0000000 --- a/my_submodule +++ b/my_submodule @@@ -1,1 -1,1 +1,1 @@@ - Subproject commit dd7404e5f35ee0b0064f0d6ed8201cc39d6ed6b2 -Subproject commit

How to solve merge conflict in a approved review in gerrit?

只谈情不闲聊 提交于 2019-12-08 05:46:14
问题 I made a change in gerrit which was code reviewed and after 7 revisions approved. But, now it cannot be merged and trying to rebase in gerrit website is not working due to merge conflict. How can I resolve this merge conflict and merge the same approved change and not create a new one. (Full steps from cloning the repo would be appreciated.) 回答1: 1) Clone the Gerrit repository git clone https://USER@GERRIT-SERVER/a/REPO-FULL-PATHNAME 2) Go to the change page on Gerrit and copy the checkout

GitLab - ignore specific files in target branch

浪尽此生 提交于 2019-12-08 04:28:20
问题 I am using GitLab in my project and I have a quite specific workflow. I have 2 branches " Dev " and " Release " as shown below. When I submit a merge request from Dev to Release, the config files are also getting overwritten with that of Dev branch. But ideally config files have to be different for both of these branches. I tried to use merge=ours . But it didn't serve my purpose as it will not override until and unless there is a conflict in config files. I don't want to add these files in

GitLab - ignore specific files in target branch

只愿长相守 提交于 2019-12-08 04:03:24
I am using GitLab in my project and I have a quite specific workflow. I have 2 branches " Dev " and " Release " as shown below. When I submit a merge request from Dev to Release, the config files are also getting overwritten with that of Dev branch. But ideally config files have to be different for both of these branches. I tried to use merge=ours . But it didn't serve my purpose as it will not override until and unless there is a conflict in config files. I don't want to add these files in .gitignore , as any changes to these files will not be committed in Dev branch. Can someone please guide