To check that Git is successfully installed, run the following command:
$ git --version
git version 2.2.1
git command works with a variety of subcommands. Simply pass in these subcommands following
Let's start by setting global configuration parameters. Use the subcommand
config to see a list of all the configurable parameters.
$ git config
usage: git config [options] Config file location --global use global config file --system use system config file --local use repository config file -f, --file <file> use given config file --blob <blob-id> read config from given blob object Action --get get value: name [value-regex] --get-all get all values: key [value-regex] --get-regexp get values for regexp: name-regex [value-regex] --get-urlmatch get value specific for the URL: section[.var] URL --replace-all replace all matching variables: name value [value_regex] --add add a new variable: name value --unset remove a variable: name [value-regex] --unset-all remove all matches: name [value-regex] --rename-section rename section: old-name new-name --remove-section remove a section: name -l, --list list all -e, --edit open an editor --get-color <slot> find the color configured: [default] --get-colorbool <slot> find the color setting: [stdout-is-tty] Type --bool value is "true" or "false" --int value is decimal number --bool-or-int value is --bool or --int --path value is a path (file or directory name) Other -z, --null terminate values with NUL byte --includes respect include directives on lookup
Git configuration files will live in your /etc/gitconfig file. Those that are specific to the user will live in ~/.gitconfig. As we'll see shortly, we can edit the settings within ~/.gitconfig with the
$ cat ~/.gitconfig
[user] email = firstname.lastname@example.org name = John Doe
Set your username and email so that you may identify yourself and your computer with others.
$ git config --global user.name "john doe" $ git config --global user.email email@example.com
When using Git, sometimes you'll need to enter a message to describe the changes you are making to the repository. When inputting these messages, you could have Git automatically open a text editor for you to type in.
By default, the text editor of choice is Vim, but in case you use emacs or another editor, you may set it with:
$ git config --global core.editor emacs
The diff tool is used to resolve merge conflicts. For Vim users, we can use
$ git config --global merge.tool vimdiff
To turn on color in the black and white terminal screen, use the following command:
$ git config --global color.ui true
This will make deletions red, and additions green.
To check the list configuration edits you made, run:
$ git config --list
Git has many subcommands that it runs. For example, the subcommand
add is used to track the files in your repository (we'll cover this in more detail later). To find any help (in case you get lost along the way), run
git help with the subcommand.
$ git help add
NAME git-add - Add file contents to the index SYNOPSIS git add [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p] [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]] [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--] [<pathspec>...] DESCRIPTION This command updates the index using the current content found in the working tree, to prepare the content staged for the next commit. It typically adds the current content of existing paths as a whole, but with some options it can also be used to add content with only part of the changes made to the working tree files applied, or remove paths that do not exist in the working tree anymore.
And don't forget git's man page!
$ git man
If you're looking to learn the elements of Agile development and Scrum, this is the book for you. This book has been reviewed by many, and sought after as a must-read for anyone who works in agile. The book is brief, with no anecdotes nor reiterations. Just pure content to help you graph what Scrum is in no time.$ Check price
Programming Python shows in-depth tutorials on the language's number of application domains including: system administration, GUIs, the Web, networking, front-end scripting layers, and more. This book focuses on commonly used tools and libraries to give you a comprehensive understanding of Python’s many roles in practical, real-world programming.$ Check price