Git- command
The words written before:
GitHub is a git repository (equivalent to a Git server) installed on a remote server.
Git is a client tool installed on the user's computer that pulls and pushes data from GitHub via the git command.
Git working principle diagram
Information Address:
http://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html
http://www.cnblogs.com/springbarley/archive/2012/11/03/2752984.html
Windows requires git client installation (git is a command-line tool| GitHub is a code repository)
remote: remote
repository: repository
checkout: detected
mkdir makefile New directory
cd makefile
git init initializes the local repository
touch readme.txt New file
git add readme.txt Add file to staging area
git commit -m "first comomit" Commit files to local repository, first comomit is comment
Add a remote repository to your local repository
git remote add origin git@git.yongche.org:yinyongjie/git-test.git
git push or git push -u origin master commits files to remote repositories
Deleting files from remote repositories:
git rm --f "filename"
git commit -m "delete file" Remarks: delete file is a remark, you can write it casually
git push
git forces local overrides:
git fetch --all
git reset --hard origin/master
git pull or git push -u origin master
git branch See all local branches
git branch -r View all remote branches
git branch -a View all local and remote branches
git branch -d master1 Remove local branch name master1
git branch baidu create baidu branch
git checkout baidu Switch to baidu branch
git checkout -Switch to previous branch
git checkout -b yidao Create yidao branch and immediately switch to yidao branch
git push origin yidao push local branch yidao to remote branch
git push origin yidao:master commits local yidao branch to master branch (merge branch)
git merge master_team Merges the main branch into the current branch
git clone git@git.yongche.org:mayi/BackendAutoTesting.git clone code locally
git checkout . (Cancel all local modifications)
git log (view commit history) press q to exit
git status