Skip to content

Instantly share code, notes, and snippets.

@Kapcash
Created July 31, 2025 14:03
Show Gist options
  • Save Kapcash/9cc444626e60263768621c80a84376f6 to your computer and use it in GitHub Desktop.
Save Kapcash/9cc444626e60263768621c80a84376f6 to your computer and use it in GitHub Desktop.
Git handy configurations

Git handy configurations

This file stores a few git configurations I use everywhere.

Specify a user for a specific folder (and subfolders)

  1. Create a .gitconfig file in the folder you want to have a specific user
nano ~/projects/client-a/.gitconfig

Set your custom user in this file:

[user]
    name = My Name
    email = [email protected]
  1. Use this partial git config file in your global git config file

If this file doesn't exist yet, you can create it.

nano ~/.gitconfig

Place this bit at the end of the file

[user]
  # global user by default
  name = My Name
  email = [email protected]

# The trailing slash / is important!
[includeIf "gitdir:~/projects/client-a/"]
    path = ~/projects/client-a/.gitconfig # path to the .gitconfig you created in step 1.

Open git rebase interactive with VSCode's GitLens interface

# Enable the GitLens UI for interactive rebase
In VSCode, run this command from the Command Palette:
> GitLens: Enable Interactive Rebase Editor 

# (Optional) Open all "interactive" git commands in VSCode
git config --global core.editor "code --wait"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment