git Three Musketeers notes

Read git Three Musketeers video summary of the notes, only for your own reference.

 

Common Commands

View branch:git branch

 

Create a branch:git branch <name>

 

Switching branches:git checkout <name>

 

Create a + to switch branches:git checkout -b <name>

 

Merge a branch to the current branch:git merge <name>

 

Deleted branches:git branch -d <name>

 

Staging area (after add) restored to the same HEAD: git reset.

 

The elimination of several recent submission: git log -graph git reset -hard commit name (head pointer to the name that you want to commit a)

 

Difference between two branches: git diff dev master (git diff dev master --index.html)

 

Delete files ways: git rm delete stuff

 

The first thing you modify stored git stash git stash pop / apply

 

Pulling git clone -b

 

Two scenarios:

      1. the existing project code into the git Management

             cd project code folder where the git init

      2. Create a new project with a git direct management

  • cd a folder git init file your_project created and the project name of the same name in the current folder path
  • cd your_project

         

  • git config --local user.name ‘shaoshuai’
  • git config --local user.email ‘[email protected]
  • git congif --local --list to see local settings highest priority if duplicate set user and mailbox
  • mkdir demo new demo folder

 

     Execute git remote -v view warehouse address

     If you enter $ git remote add origin [email protected]: djqiang (github account name) / gitdemo (project name) .git 

      Tip error message: fatal: remote origin already exists.

      Solution is as follows:

      1, first enter the $ git remote rm origin

      2, then enter the $ git remote add origin [email protected]: djqiang / gitdemo.git would not have given up!

Guess you like

Origin www.cnblogs.com/shaoshuai0305/p/11032490.html