More generally, whenever you type git something, if something is not a built-in command or defined alias, Git searches its installation path (often /usr/lib/git-core) and then your own search path for a program named git -something. git commit"ĭefines an alias git setup, which sets up a new repository using the contents of the current directory. An exclamation point means to pass the alias definition to the shell, letting you use more complex aliases for example, this definition in ~/.gitconfig: This command: $ git config -global alias.cp cherry-pickĭefines git cp as an alias for git cherry-pick. Git has its own internal alias system as well, which may be more convenient. Most systems provide a way to abbreviate long commands with user-defined command aliases for instance, using alias in your Unix bash shell startup file ~/.bashrc. Note that when you’re quoting commit IDs in a public or “for the record” context, it may be best to use the full ID, to avoid any future ambiguities. To see the full identifiers as a per-command exception, use -no-abbrev-commit. core.abbrev is the length of the shortened identifiers in digits the default is 7 in most cases. Where the commit messages would otherwise be pushed halfway off the screen to the right by the full identifiers. This improves readability in various places, especially in log output such as: $ git log -pretty=onelineĢ22433ee Update draft release notes to 1.7.10ħ0eb1307 Documentation: do not assume that n -> 1 in … You can tell Git to abbreviate commit IDs generally with : $ git config -global log.abbrevCommit yes $ git config -global core.abbrev 8 When referring directly to an object identifier, it is usually not necessary to quote the entire 40-character hexadecimal SHA-1 value any initial substring unique to the current context will do. See git-config(1) for more detail on the format of the configuration files, its many parameters (some mentioned in this text and some not), and other uses of git config, such as querying the current setting of a parameter. Parameters that take Boolean (yes/no) values can be given as yes/no, true/false, or on/off. Settings made in a later configuration override those from an earlier one so that, for example, you can set your normal email address with -global but change it for commits made in a specific repository if you use a different address when corresponding about that work. Git reads these three configurations, each if available, in the order system, global, then local. It’s not common to do that anyway usually this file would be maintained separately, perhaps using a configuration management system such as Puppet or Chef. This file is usually writable only by a system administrator, so you’d need to be root to run this command to make a change. The -system option changes the system-wide configuration on the machine you’re logged into, which applies to all users its location may vary, but is usually /etc/gitconfig. Otherwise, the default is -global, which applies to your overall personal Git configuration in ~/.gitconfig. If you give this command when your current directory is inside a Git repository, it implies -local, and it will change the configuration for that repository only, in the file. To set a parameter with git config: $ git config - parameter value You use these names when reading or setting parameters with git config, rather than editing the file yourself.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |