Git study notes - records related commands

Content from: https://www.liaoxuefeng.com/wiki/896043488029600/896067074338496

1.Linux install Git

First, you can try to enter gitand see the system has not been installed Git:

$ git
The program 'git' is currently not installed. You can install it by typing:
sudo apt-get install git

Like the above command, there are many Linux friendly and will tell you Git is not installed, will tell you how to install Git.

If you happen to use Debian or Ubuntu Linux, through a sudo apt-get install gitwill can be done directly Git installation is very simple.

Little old Debian or Ubuntu Linux, the command should be changed sudo apt-get install git-core, because in the past there is a software called GIT (GNU Interactive Tools), Git result can only be called git-coreup. Because Git fame is too great, then put into GNU Interactive Tools gnuit, git-coreofficially changed git.

 2.windows install Git

Git directly from the official website to download the installer , after the installation is complete, find the "Git" in the Start menu -> "Git Bash", jumped out a window similar to the command-line stuff, it shows Git installed successfully!

After installation, you need to set the final step, at the command line:

$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"

Note that git configthe command --globalparameter, use this parameter, all Git repository that you will use this configuration on this machine, of course, you can specify a different user name and Email address of a warehouse.

 3. Create Repository

Warehouse repository, also known as the English name repository

$ Mkdir learngit // Create a directory 
$ cd learngit // into the directory created inside the 
$ pwd // command is used to display the current directory
 / Users / michael / learngit

The second step, through the git initcommand to manage this directory can become a Git repository:

$ git init
Initialized empty Git repository in /Users/michael/learngit/.git/

Initialize a Git repository, use the git initcommand.

Add files to the Git repository, in two steps:

  1. Using the command git add <file>, pay attention, it can be used repeatedly to add multiple files;
  2. Use the command git commit -m <message>to complete.

Guess you like

Origin www.cnblogs.com/csl96/p/11281078.html