Possibly among the most embarrassing error messeras to get stuck in once using the git advancement hub entails commit messperiods after doing a normal merge. You could watch a line instructing you to please enter a commit message to explain why this merge is crucial, but if you write anything tright here it doesn’t permit you to exit. The reason this is so embarrassing is bereason this isn’t an error message at all.

You are watching: Git please enter a commit message to explain why this merge is necessary

The prompt is actually tright here for people that have to edit git merges, and any kind of message you add in is ssuggest an alert ot various other developers that could be looking at what you wrote. You need to leave the editor the exact same method you would if you were using it from a conventional terminal screen.


Exit git Merges that Ask for Commit Messages

Usually, you’ll see this if you’ve percreated a normal merge on git as component of a separate document. Sometimes you can acquire this prompt after a block of code as soon as you merge an updated upstream right into its own topic branch. None of the documentation from git describes what to do when you reach it because it genuinely isn’t a prompt at all.

*
Both lines of this message begin through the # symbol, which suggests that they’re comments. Due to the fact that git doesn’t understand how many type of developers are functioning on a project, this is included so you have the right to leave a message to others about why you combined an upstream right into a topic branch. You have to know which editor you’re utilizing to exit it, yet.

In a majority of instances, you’re making use of the vi or vim editors. Push the Esc essential then kind :wq and press enter to exit. This is the same way that you’d leave from vim on any type of other occasion. This conserves the file and then exits, which will certainly take you best out of git.


Notice any cues that could help you to know what type of editor you’re using. In our instance screenswarm, the extra tilde characters showing new lines yet to be put into a file were a telltale giveamethod that the git platdevelop put us into vim. Then aobtain, if you can’t number out what editor you’re using, press Esc and also use the :wq command also bereason vi and also vim are virtually universal at this allude so you’ll uncover this will certainly typically get you out.

On the other hand, if you were using nano then simply push Ctrl+X and also form y when asked whether to conserve transforms. As soon as you press enter, you’ll be out of git and ago wherever before you were beforehand. You’ll mainly alert a line at the peak of the terminal that reads “GNU nano” in these situations. If not, then look for a number of key-board shortcuts at the bottom of the window.

If you find that neither of these approaches work, then push Ctrl+X adhered to by Ctrl+C to exit. This must obtain you out of git on the off possibility that you were utilizing the emacs editor. This is an unusual circumstance. In many cases, Esc complied with by :wq need to work and Ctrl+X adhered to by y have to work in instances wright here that doesn’t. You’ll want to use Ctrl+X complied with by Ctrl+C just if you either recognize you’re in emacs or if these 2 methods don’t occupational. Ctrl+C need to also occupational, albeit without conserving, if you’re using the JOE editor at your git terminal.

Once you’re out and earlier at the prompt, form cat ~/.gitconfig | grep editor at the terminal to uncover out which editor you were stuck in for certain. You’ll get a line earlier that reads somepoint prefer editor = vim, which would be the name of the editor that git defaults to. In the future, you have the right to use the typical approach to exit that editor if, after a normal git merge, you watch the “Please enter a commit message to define why this merge is necessary” line again.

You could also wish to modify the file, through whatever text editor you typically favor, and also change the editor to whatever it is you prefer. Scroll dvery own to wbelow it reads and also then adjust the line that reads “editor = vim” to read whichever one you’d choose. For circumstances, you can desire it to review “editor = nano” if you prefer to use the nano editor to code through.


By Kevin ArrowsJune 14, 2019
3 minutes read
*

Kevin ArrowsNetwork Engineer (LAN/WAN) |
Kevin is a dynamic and self-encouraged indevelopment innovation expert, via a Thostormy expertise of all facets pertaining to netjob-related facilities architecture, implementation and also administration. Superior document of carrying simultaneous large-scale mission crucial tasks on time and under budget.

See more: Why Are There Several Ethnic Variations Of The 2005 Mypyramid?


About | Privacy Policy | Cookie Policy | Update Consent| Terms & Conditions | Editorial Guidelines | Affiliate Disclosure | Contact Us
Close
HOW-TOBUYER GUIDES

Expert Tip


Fix: Please enter a commit message to describe why this merge is necessary

If the problem is via your Computer or a Lappeak you have to attempt using Restoro which deserve to shave the right to the repositories and relocation corrupt and also missing files. This functions in the majority of cases, where the problem is originated because of a device corruption. You can download Restoro by clicking the Downpack switch below.