Also outputs the key names.įor writing options: write to global ~/.gitconfig file rather than the repository. Like -get-all, but interprets the name as a regular expression. Like get, but does not fail if the number of values for the key is not exactly one. Returns error code 1 if the key was not found and error code 2 if multiple key values were found. Get the value for a given key (optionally filtered by a regex matching the value). This replaces all lines matching the key (and optionally the value_regex).Īdds a new line to the option without altering any existing values. You try to unset/set an option for which multiple lines match, orĭefault behavior is to replace at most one line. You try to unset an option which does not exist, git/config unless defined otherwise with GIT_DIR and GIT_CONFIG (see the section called "FILES"). The default is to assume the config file of the current repository. The file-option can be one of -system, -global or -file which specify where the values will be read from or written to. If no type specifier is passed, no checks or transformations are performed on the value. The type specifier can be either -int or -bool, to make git config ensure that the variable(s) are of the given type and convert the value to the canonical form (simple decimal number for int, a "true" or "false" string for bool), or -path, which does some path expansion (see -path below). If you want to handle the lines that do not match the regex, just prepend a single exclamation mark in front (see also the section called "EXAMPLES"). Only the existing values that match the regexp are updated or unset. If you want to update or unset an option which can occur on multiple lines, a POSIX regexp value_regex needs to be given. Multiple lines can be added to an option by using the -add option. The name is actually the section and the key separated by a dot, and the value will be escaped. You can query/set/replace/unset options with this command. Git config -rename-section old_name new_name Make sure you know how to get back to your current state if it messes up.Git-config - Get and set repository or global options # Add custom git extensions git() f' git stash-unstaged: stash only unstaged changesīe careful this is destructive. This command only allows git commit -am if everything is staged or if nothing is staged, because if only some things are staged, then you probably are preparing the stage partially on purpose. Sometimes I spend time carefully adding chunks to the git stage, then I run git commit -am by habit and accidentally wipe all the work I put into preparing the stage. I use a combination of the Function Command Extension Trick and a git-config script for my git customization: Git Function Command Extension TrickĮach section here shows a self-contained, copy-pastable piece of functionality, and the Combining all the above tips section combines them together. local pattern) or to a separate machine-specific git-config script.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |