After you install GIT, first configure global to be globally public only for first-time configuration.
$ git config --global user.name "Your Name" $ git config --global user.email "[email protected]"
Create an empty directory, and then
Git init Initializes a hidden file
git add txt.txt adding repositories
Git add–all Add all
git commit–m "Modify description" submitted to the warehouse
Git Status View status
git diff changes the place
git log--pretty=oneline print version history
git reset --hard HEAD^ 版本回退 一个版本^ 或~1;
git reset --hard comitID
git reflog Every command that is logged
git checkout -- file.file 回到上个版本的状态 /回到add到暂存区状态
git checkout 切换到另外一个分支
git rm file.flie 删除指定文档
若果没有SSH Key (用户目录下查看) 创建SSH KEY
ssh-keygen -t rsa -C "email addr" 创建SSH 出现ssh文件夹
Id_rsa Private key
Id_rsa.pub Public key copy to GitHub inside SSH security
git remote add origin repositoryaddr
git push -u origin master 当前分支master 和远程分支master关联起来
git push origin master
关于ssh 你把ssh公钥给别人 别人登记了你的公钥才能识别你 才愿意给你push的权利
git clone respostoryaddr clone Remote Library to local support for multiple protocols
Head pointing to master master pointing to the latest commit
When creating a branch, add Dev to replace the original master function Merge branch is to point master back to the latest, remove dev
git checkout -b dev 创建分之[dev] 切换到分支
等价于:
git branch dev + $ git checkout dev
git branch 查看当前分支
git checkout master 切换到主分支
git merge dev 合并分支
git branch –d dev 删除分支
修复bug ==> 创建分支 修改 提交 合并分支 删除分支
When git cannot merge branches automatically, you must resolve conflicts first. Resolve conflicts, then submit, Merge complete
git log–graph View Branch map
git merge --no-ff -m "merge with no-ff" dev 禁用fastforward 模式
Git status stores the current work site
Git Stash List View Job Site
The above 2 commands are equivalent to git stash pop
Git branch-d branch name forcibly deletes an attribute branch (this hint appears only if the branch is not merged)
git remote -v 查看远程库 默认origin
git push origin master/dev 推送至对应的远程分支上
git checkout -b branch-name origin/branch-name 创建本地和远程对应的分支
本地分支和远程分支的关联
Git pull to manually resolve the conflict locally, and then push
Working mode: Git push origin branchname if failed git pull resolve conflict, then push
git checkout master 切换到打标签的分支 git tag name
git tag-a <tagname>–m "tag Info"
git tag -s <tagname> -m "bl" PGP signature Tag;
git tag View all tag information
Git common Command collation