poll: if you use Git, do you use a terminal text editor to edit your commit messages? (or other things that Git asks you to edit like interactive rebases etc)
(you can pick more than one)
poll: if you use Git, do you use a terminal text editor to edit your commit messages? (or other things that Git asks you to edit like interactive rebases etc)
(you can pick more than one)
@b0rk When in the terminal, which is most of the time, I use a terminal editor. But if I am in Emacs, I use Magit, the Emacs git frontend.
@b0rk _nearly_ got to tick all the boxes! I use emacs, but depending on the circumstances, it might be an emacs launched specially when I run 'git commit' from the shell prompt, or I may be running Magit in an emacs I had already. In either case the emacs may be GUI or tty-only, depending on whether I'm doing it at the other end of an ssh connection.
Alas, I couldn't think of any excuse to tick the 'other' box too :-)
(I do have a completely daft trick where I set VISUAL="cp file.txt", causing git to use the contents of that pre-prepared file instead of spawning an editor. But I only use that for prewritten 'git rebase -i' lists. For commit messages, there's no need: 'git commit' has a perfectly good -F option.)
@simontatham VISUAL=“cp file.txt” is incredible
That's horrible (complement).
(I'd be *way* too nervous to do that, and would just have the editor insert the prewritten text, though.)
@suetanvil @b0rk the usual reason I'm providing a prewritten 'git rebase -i' list in the first place is so I can try it over and over again until I get it right. For the same reason, I usually also make a separate clone of the git repo to do it in, so that I can mess up the first 10 attempts without doing any permanent damage!
@simontatham @suetanvil @b0rk When I'm going to do a rebase that I'm afraid I might mess up, I start with `git checkout -b rb`, and rebase that instead. Then when I'm happy with `rb` I reset the real ref to the same place. If I'm unhappy I delete `rb` and nobody is the wiser.
Why would you want to use a fresh repo?
@b0rk In “other”: I also use -m “…” from the command line if the message is simple enough
@b0rk I currently use gitui which is a TUI, which is perhaps not the same thing as a GUI? If I'm writing a longer commit message I'll open it in a terminal text editor, currently micro.
@b0rk I just use git commit -m and put the message in the terminal. Is that using a terminal editor?
@b0rk Commits and interactive rebases through vim because add-ons correctly wrap and highlight everything for me so i don't need to worry about line length or proper wrapping.
That said, the gitlens UI for interactive rebases in vscode is pretty good and I do use it whenever it decides to show it instead of popping my $EDITOR in the terminal pane, which is a coin toss for some reason.
@b0rk I also know the -m "message here" CLI syntax and very occasionally use it.
@benofbrown @b0rk I've seen beginner guides use it (Djangogirls at one point), because it avoids having to get into the weeds about setting nano up, or worse, vi
@b0rk Follow-up question would be "Terminal text editor: vim vs nano" 😂
@b0rk I clicked the GUI option as it's the closest, but I actually have GIT throw up an Emacs window, which is technically graphical but looks like a text interface.
@b0rk Console editor for the most part, but I cobbled together a special flow for commits. It opens a tempfile in an editor and pops up a new terminal window running gittui. I can review edits in the latter while staging files, but still make notes in the former. When I quit the editor, the commit fires.
https://git.odin.cse.buffalo.edu/okennedy/random-hacks/src/branch/main/git-review
@b0rk I use the Lazygit plugin in Neovim (which is kind of an IDE 🙂) in a terminal, so I don’t know which category that’s in 😅
@b0rk For some reason, I don't trust GUI tools to manipulate the git repository (probably because some GUI tool I've once tried to use made a mess of the repository state, turning a merge into a non-merge with the contents which should have been in the merge). So when editing files to resolve merge conflicts or when adding files and committing, I always use the trusty command line; which then defaults to the terminal text editor I have configured as default.
@b0rk Too lazy to change the default. I know vi well enough that it’s not a problem, plus I don’t want to switch out to a GUI text editor while I’m in the terminal.
@b0rk Either the terminal text editor or Lazygit.
@b0rk I create most of my git commits through the "fugitive" vim plugin. That keeps most of my commit messages inside my running vim session. Occasionally I'll do one in a command line, though, and that opens vim (my $EDITOR).
@b0rk I use lazygit. Guess that counts as "other".
@b0rk IMHO lazygit should have been an option
@b0rk most of the time i just write my commit message with -m but my .bashrc is configured with
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
export EDITOR='code --wait'
else
export EDITOR='nano'
fi
so for when i need to write a longer one or i'm doing an interactive rebase or something, it depends on where i'm making the commit from
@b0rk is readline a text editor? 🤔 (see git commit -F -)
@b0rk Random, depending on what exactly I'm doing, how extensive the commit message is going to be (they don't all need to be essays) and how I'm feeling.
@b0rk lazygit (TUI)
@b0rk sometimes I use gitui, a terminal based git interface.
@b0rk I use Lazygit for most things Git. It’s a beautiful program.
@b0rk Other: if I'm in the terminal (eg. ssh'd into a remote system) I'll try to use helix or vim if they're available to do commit messages. Otherwise I just commit directly in the IDE I'm using (Zed/VSCode).
@b0rk Additionally, if I have it installed, I'll use lazygit
@b0rk I voted other but maybe I'm 'terminal + magit'. For regular commits I basically always use Magit to make selective commits (so Magit + GNU Emacs and it's almost always as a GUI, not in a terminal). But when rebasing, if I hit a rebase conflict I fix it in the terminal and then 'git rebase --continue' usually throws me into vim to maybe fiddle with the old commit message.