Search found How can I edit the .git / config file from the git terminal?. The answer tells e.g. to use editor of choice to edit .git/config
. I'm currently investigating IMO strange behavior of git in my repo and suspect my manual edit of .git/config
might play a role.
As of now I see many files in .git
are text files expect objects (which AFAIK are "actual work files", delta's of them). However there are binary index
and sometimes packed-refs
. I recall reading packed-refs
is used to speed up search (How to unpack packed-refs?).
Say:
git branch --set-upstream-to=origin/test
error: the requested upstream branch 'origin/test' does not exist
But I can just edit config replacing main
with test
in merge = refs/heads/main
. Also replace URL of remote (that I did many times), replace commit hashes in refs, add refs and folders with refs (say copy refs/remotes
from other repo), add lines to .git/config
, literally write/add/delete anything that is valid git
syntax.
Can any of the above break some internal git repo consistency? If yes, is there an easy way to update repo to consistent state honoring my edits?