1

I need to know how to manually edit every merge. I found answers on here but everything is only when there is a conflict of merging. I implemented these and if there are new files pulled or no direct conflict between the code it will auto merge, which I can't have.

I want to manually OK every new file, line of code, and conflict with the mergetool.

Please help ive been trying to figure this out for more than a week.

  • Why would you want to manually merge every file? – mipadi Jul 31 '14 at 19:40
  • Owner of the company wants us to submit our changes to him, he will manually approve everything and then push to production server. Just ensuring nothing gets overwritten which git can easily do if there are no conflicts thrown – Jason Nicholas Jul 31 '14 at 19:59
  • The great thing about git, though, is that you can always go back to a previous version if the owner doesn't like the newest revision. So the owner could review after the fact instead of being a possibly time-consuming part of the process. – Wander Nauta Jul 31 '14 at 20:02
  • @JasonNicholas: Why not have him do the merge after he reviews changes? – mipadi Jul 31 '14 at 21:37

1 Answers1

2

If you use the --no-commit flag to git merge, git will execute the merge, but not make a commit of the proposed merge, so you can review it any way you'd like, including git difftool.

If you agree with the merge, do a regular git commit. If not, just work with the commit as usual until you're satisfied.

(By the way, as you've seen, Git will never automatically commit when the merge causes conflicts.)

Wander Nauta
  • 18,832
  • 1
  • 45
  • 62
  • I only recently learned about difftool and how to define which tool you would like to use. While I like the answer I've had quite a few times that after pulling with no commit and no ff, difftool does not open. Would you happen to know any cause for this? I have it in the config and it works fine sometimes. – Jason Nicholas Jul 31 '14 at 19:57
  • "Sometimes" is a bit hard to debug without more context. You may have more luck asking a seperate question for that. – Wander Nauta Jul 31 '14 at 20:01
  • C:\Users\Chris\Documents\GitHub [master]> git pull --no-commit --no-ff -u testing master remote: Counting objects: 118, done. remote: Compressing objects: 100% (71/71), done. remote: Total 118 (delta 33), reused 87 (delta 25) Receiving objects: 100% (118/118), 11.24 KiB | 0 bytes/s, done. Resolving deltas: 100% (33/33), done. From https://github.com/NicholasJM/gitTesting * branch master -> FETCH_HEAD * [new branch] master -> main_gca/master – Jason Nicholas Jul 31 '14 at 20:04
  • used git difftool after this and nothing happens – Jason Nicholas Jul 31 '14 at 20:05