git github gilab code management tools multiplayer co-management tool distributed code management tool
addressing people development projects do not conflict with the code
version control system
three areas:
the workspace staging service area
to create a github repository steps:
1. First, login to your the github account, create a remote repository
2. create a local repository
Note: to create a new file for the first time initialization, otherwise the submission will complain empty
git init 初始化
git status 查看文件状态
git add. 添加所有文件到暂存区 git add文件名添加单个文件
git config--global user.name "用户名"
git config --global user.email "邮箱"
git commit -m "注释" 提交文件并注释
git remote add origin+仓库地址 链接远程仓库
git push -u origin master 提交内容到moster分支 首次提交 之后直接git push
git common instruction:
git clone 仓库地址 克隆项目
git pull 拉取
:wq
分支 branch分支
git branch 查看本地分支
git branch +分支名称 创建分支
git checkout 分支名称 切换分支
git branch -r 查看服务端分支
git checkout -b 分支名称 创建并切换到分支
git branch -d +分支名称 删除分支
git merge +分支名称 合并分支
git push --set-upstream origin +分支名称 推送本地分支到远端 (git push origin +分支名称)
git push origin --delete +分支名称 删除远端分支 git push origin :dev
git branch -m ( dev devlop) 更换分支名
git rm --cached /day06/1.txt
git rm --cached 删除文件
git diff 版本对比
git log 查看日志
git stash 封存
git tag 打标签
git fetch 拉取