Signing your Git commits with a GPG key can help verify the authenticity of your changes. Instead of manually specifying the -S
flag with each commit, you can configure Git to automatically sign your commits.
To set this up globally, run the following commands:
1git config --global user.signingKey <yourSigningKey>
2git config --global commit.gpgSign true
user.signingKey
: Specifies the GPG key you want to use for signing commits. Replace <yourSigningKey>
with the actual GPG key ID.commit.gpgSign
: Enables automatic signing of all commits.Once configured, Git will sign all your commits by default, making it easier to ensure your commits are properly authenticated without needing to manually specify the -S
flag each time.
When switching between branches in Git, it’s possible that files you have open in Vim may have been modified outside of the editor, without you realizing it. This can lead to a situation where the buffer in Vim becomes stale and no longer reflects the current state of the file on disk.
To handle this more effectively, you can configure Vim to automatically detect and reload files when they change on disk. Here’s how you can set this up in your .vimrc
:
1set autoread
2au CursorHold * checktime
set autoread
: This tells Vim to automatically reload a file if it has been modified externally.au CursorHold * checktime
: This creates an auto-command that triggers a check whenever the cursor is idle for a brief moment (CursorHold
). It checks whether the file has changed since it was last read.With these settings in place, Vim will automatically reload the buffer if the file changes on disk, helping you stay in sync with the latest changes.
If you’ve made local changes to the file and haven’t saved them, Vim will alert you that the file has been modified externally. You’ll then have the option to either:
This ensures that you can make informed decisions about how to handle the state of your file, avoiding conflicts between the file on disk and your in-memory buffer.
Welcome to my new microblog! This space is inspired by Julia Evans’ recent post on starting a microblog (link), and I plan to use it as a place to jot down quick notes, discoveries, and solutions to technical problems. It’ll also serve as a way to publish some long-term draft posts that may have otherwise stayed unfinished.
My first attempt here accidentally turned into a full-length blog post: How to Delay Application Startup in Xfce.
So, I guess I’ll need to work on keeping things short and to the point!
BTW: There’s a separate RSS feed for the microblog here.