in Technology by
Explain How can we make Git use the editor of my choice for commits?

1 Answer

0 votes
by
 
Best answer

If you want to set the editor only for Git, do either (you don’t need both):

  • Set core.editor in your Git config: git config --global core.editor "vim"
  • Set the GIT_EDITOR environment variable: export GIT_EDITOR=vim

If you want to set the editor for Git and also other programs, set the standardized VISUAL and EDITOR environment variables*:

export VISUAL=vim
export EDITOR="$VISUAL"

* Setting both is not necessarily needed, but some programs may not use the more-correct VISUAL. 


For Sublime Text: Add this to the .gitconfig. The --wait is important (it allows to type text in sublime and will wait for save/close event.)

[core]
    editor = 'subl' --wait

'subl' can be replaced by the full path of the executable but is usually available when correctly installed.

Related questions

0 votes
    I would prefer to write my commit messages in Vim, but it is opening them in Emacs. How do I configure Git ... for a single project. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    3. Multiple choice questions. a. We can use step with this type of loop i. For Next ii. While Wend iii. Do ... . 10 iii. 11 iv. 12 Select the correct answer from above options...
asked Dec 12, 2021 in Education by JackTerrance
0 votes
    How can we make ignore file mode (chmod) changes in git?...
asked Jan 8, 2021 by JackTerrance
0 votes
    How to delete unpublished Git commits and get rid of them permanently? A. git reset –hard B. git revert C. git reset –soft...
asked Dec 20, 2022 in Technology by JackTerrance
0 votes
    How to change the author and committer name and e-mail of multiple commits in Git?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    git reflog tracks the commits that are made and the commits that are discarded. A. True B. False...
asked Dec 24, 2022 in Technology by JackTerrance
0 votes
    What is the Git command to view the last three commits in a line? A. git last 3 commits B. git log -–oneline -3 C. git show log -3 D. git log...
asked Dec 23, 2022 in Technology by JackTerrance
0 votes
    What is the Git command to view all the commits since 1st January 2017 ? A. show git log since Jan 1 2017 B. git log ... =”2017-01-01” C. git log D. None of the options...
asked Dec 21, 2022 in Technology by JackTerrance
0 votes
    What is the Git command to view the last 3 commits in one line ? A. git show log -3 B. git last 3 commits C. git log D. git log -–oneline -3...
asked Dec 21, 2022 in Technology by JackTerrance
0 votes
    What is mean by 'src refspec master does not match any when pushing commits in Git?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    I would like to know how to delete a commit. By delete, I mean it is as if I didn't make that commit, ... -hard HEAD. Is this correct? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    Which command would you use to view the history of commits? A. git view history B. git show history C. git log D. git show commits...
asked Dec 17, 2022 in Technology by JackTerrance
0 votes
    Microsoft now has support for Git repositories on their Team Foundation Service. I have an account on Team ... to TFService. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I have this grid: If I change the tables width from 100% to auto, table collapses horizontally. Which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    Can we create Dynamic Classes in Objective C? If Yes, Explain how to create with a valid use case?...
asked Nov 10, 2020 in Technology by JackTerrance
...