git config --edit
opens the config file in sublime text (Awesome)
You can use the following commands to open a file in git bash:
vi <filename> -- to open a file
i -- to insert into the file
ESC button followed by :wq -- to save and close the file
Hope it helps.
Any other terminal based text editor, like vim, nano and many will also do the job just fine.
Git has nothing to do with how you open/edit files in your project. Configuring the editor in git is only so that git internal things that require an editor (commit messages for example) can use your preferred editor.
If you just want to open files from the command line (cmd.exe) as if they were double clicked in the windows explorer, I think you can use start <filename>
.
I used Atom, to open files this works for me
atom index.html
Hopefully this helps.
I was able to do this by using this command:
notepad .gitignore
And it would open the .gitignore file in Notepad.
Maybe could be useful to open an editor from a script shared in a git repository, without assuming which editor could have anyone will use that script, but only that they have git.
Here you can test if editor is set in git config, and also open files not associated with that editor:
alias editor="$(git config core.editor)"
if [ "$(alias editor | sed -r "s/.*='(.*)'/\1/")" != "" ]; then
editor <filename>
else
start <filename>
fi
Works great with my .gitconfig on windows:
[core]
editor = 'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin
You must have an application associated with the file type. You must be in the folder that houses the file.
In gitbash: start file.extension