Following from yesterday’s tip, suppose you have a branch that you plan to merge, but before the merge is committed, you want to verify things. Perhaps you want to hit F5 or perform some other testing. In other words, you are telling git, “Do the merge, but allow me to hit the commit button.”
I guess this is an inverse of “sudo make me a sandwich” which would be “hey sudo, about that sandwich, if you take all the stuff out of the refrigerator, I’ll finish making it myself.”
git merge –no-ff –no-commit branch-name
Note: I’m using the –no-ff option because I don’t have an actual merge conflict in my branch, so I need to tell git not to do a fast-forward.
If you do a `git status` you’ll see that all conflicts fixed, but you’re still merging, just as the scary (master|MERGING) tells you.
Notice how the next line tells you to do a `git commit`and the Changes to be committed looks like a good old staging message.
From here, we just need to do a `git commit` (which would open your `git config core.editor` – mine is set to notepad. baby steps)
Or you could skip the editor (in case the scary Vi appears) and do
git commit -m “my merge message”
And doing a `git log` shows the initial readme being added, then the commit from the mybranch4, then the merge commit!