Want to find that mysterious git setting that keeps turning your commits into chaos The command you need is small and merciless and it tells you exactly which file is lying to you
Open a terminal in your repo and run the following This prints each config key with the file path that supplied the value so you can stop guessing and start deleting
git config --list --show-origin
The output shows lines that include the file path and the key equal value pair This is the single command that saves time and dignity when an option misbehaves
Git settings can come from multiple places Local repo config global user config and system config are the usual suspects Local settings in .git config override your global dotfiles so if your repo acts weird check the repo first
Keep this precedence in mind when you find duplicate keys The show origin output gives the file path so you know which file to edit
Pipe the output to a search tool to narrow things down For Unix like systems use grep For Windows use findstr Examples below
git config --list --show-origin | grep user
git config --list --show-origin | findstr user
That finds user name and email settings without scrolling through unrelated decorations
Change or remove values using git config commands so you do not break your dotfiles by accident Use the edit command for sane edits or unset to remove a key
git config --global --edit
git config --local --edit
git config --global --unset user.name
git config --unset user.email
You can also open ~/.gitconfig in a text editor if you enjoy living dangerously Manual edits are fine but commit your dotfiles or stash them somewhere if you care about being able to undo
There you go The next time Git does something weird run the show origin command first then fix the file that caused the trouble You will feel smarter and your CI will stop yelling at you
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.