Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Merging Merge Conflicts

Commit Message after a conflict. How to commit when using VIM.

I couldn't figure out what the instructor did to commit after a conflict and when he received the conflict message. I'm following along on my own git (windows) and I read that something with VIM can cause an issue? Not sure what that means. I don't have the options at the bottom of the screen like the instructor. Where am I going wrong?

4 Answers

Aaron Graham
Aaron Graham
18,033 Points

The instructor is using a different editor (nano, if I remember correctly). Vim shouldn't cause any issues, but the key combinations you use to edit and save your work will be different than what the instructor used, and vim doesn't show possible commands at the bottom of the editor.

If you have a conflict that git is unable to resolve on its own, it will mark the conflict in the file so that you can decide what to keep and what to discard. If you open the file, there should be clear indicators of the conflicts. Once you have them resolved, you can proceed with the commit.

Here is something to help you out with vim: http://www.fprintf.net/vimCheatSheet.html And this should help with the merge conflicts: https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line

Simon Tharby
Simon Tharby
2,951 Points

I also recommend running 'vimtutor' (without the quotes) in your console, if you have vim installed, and taking the 1 to 2 hours needed to get used to the basic controls and commands.

In answer to your original question, (since others may benefit too), the text editor is opened simply to add a description to the commit. Once a suitable description has been typed, the 'file' (edited text containing the new description) needs to be saved and the text-editor exited. Therefore, you need to know how to do those things in whatever text editor opens, or change the default text-editor to one you do understand (as described in Ben's post above).

The '-m' flag allows you to add this message without using the text-editor.

For example; git commit -m "description of commit here"

B Nawaz
B Nawaz
13,402 Points

Vim can be tricky in my opinion, and it took me ages just to work out that to quit Vim needs you to type ":q Enter". I would recommend changes your git.config file so that nano is your default text editor, and make you life easier!

http://stackoverflow.com/questions/2596805/how-do-i-make-git-use-the-editor-of-my-choice-for-commits

Thank you! Very helpful. That was exactly what I wasn't understanding.