GitHub common command line

GitHub common command line

Installation and Configuration
Installation
sudo apt-get install git
installation is successful, run the following command
git
Clone warehouse server

In the specified directory clone server repository (/ home / user / Desktop / Test)

url clone git
clone project

Code Submit

The content is added to the staging area
git add the file name or path (./)
1
submit code to a local repository
git commit -m 'Remarks'
1
will push the code to the server
requires a user name and password

git push origin dev (designated branch)

Code update

Pull information from the server
git pull origin dev [: dev]

Description: pull back to the current branch content may be omitted

Branch Management

Create a local branch
git checkout -b branch name
Example:
git checkout -b itcast

View the list of branches
git branch
switching branch
git checkout branch name
Example:
git checkout dev

Local scores tracking server branch
git branch --set-upstream-to = origin / local branch branch name Name
Example:
git branch --set-upstream-to = origin / dev itcast

Save username and password

Open the config files in .git local project folder

Add:
Helper = Store
re-enter the username and password can be saved to live after.

The native code uploaded to Github
git the init
git the Add.
Git the commit -m "First the commit" (First the commit contents of the submission)
git the Add Remote Origin (+ address you build the project)
git the Push -u Origin Master (this one when executed git may need to enter your account number and password)

Guess you like

Origin blog.csdn.net/xiao____hit/article/details/93402138