多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
#### "多人协作"小结 查看远程库信息,使用git remote -v; 本地新建的分支如果不推送到远程,对其他人就是不可见的; 从本地推送分支,使用git push origin branch-name,如果推送失败,先用git pull抓取远程的新提交; 在本地创建分支,推送到远程,成为远程分支,使用git branch branch -name,git push origin branch -name; 建立本地分支和远程分支的关联,使用git branch --set-upstream branch-name origin/branch-name; 从远程抓取分支,使用git pull,如果有冲突,要先处理冲突。 原文链接:https://blog.csdn.net/ZYZMZM_/article/details/89057506 #### 1.第一次提交代码时需要添加密钥对: cat ~/.ssh/id_rsa.pub //查看公钥内容并复制 如果没有用户公钥,可使用 ssh-keygen 命令生成 #### 2.GIT命令: git branch //列出本地分支 git remote //列出远程仓库 git checkout -b xxx //从当前分支检出新分支 git reset --hard+数字 //版本回退 git stash //暂存 git merge xxx //合并分支,将 xxx 分支合并至当前分支 .gitignore //忽略的文件列表 .git/config //当前项目的 git 配置文件 git branch -h 查看命令帮助 git branch 查看本地分支 git branch -a 查看所有分支(本地+远程) git checkout abc 切换到 abc分支 git merge xyz 将xyz分支合并到当前分支 git checkout -b zzz 从当前分支检出新分支 zzz ,并切换到 zzz分支 git branch -d xxx 删除 xxx 分支 git branch -D yyy 删除 yyy 分支 git pull --rebase #### 3..git/config [user] email = xxx user = xxxx avexwmimbsfjdiif(QQ邮箱授权码) bgdvtorvlogydhid(QQ邮箱授权码) #### 4. 常用命令: git status // 查看状态 git add xxx // 添加文件 git commit -m "xxx" // 提交 git diff xxx //查看未提交的修改 git checkout xxx // 撤销 xxx文件的修改(提交之前) git log // 查看提交记录 git log --pretty=oneline // 单行显示提交记录 分支常用命令: git branch // 查看本地分支 git checkout -b xxx // 从当前分支 检出新分支,并切换到新分支 git checkout test // 切换到 test分支 git branch -d test // 删除 test分支 git branch -D test // 删除 test分支 git merge xxx // 将xxx分支合并到当前分支 版本回退: git reset --hard xxxxxxxxx // 回退到指定提交 暂存 : https://www.cnblogs.com/zndxall/archive/2018/09/04/9586088.html git stash 将未提交的修改暂存 git stash list git stash pop 打标签: git tag -a v1.1.0 685c0d5 -m "注释" //给 685c0d5 提交打标签 git tag -d v1.1.0 //删除标签 GITHUB: 官方网站: https://github.com/ 通过WEB形式使用GIT. 两种方式传输数据: ssh(需配置公钥) git@github.com:xxxx/xxx.git https(需要用户名 密码) https://github.com/xxx/xxx.git GIT: 官方文档: https://git-scm.com/book/zh/v2/ 相关概念: git仓库(repository): 保存代码的地方 https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E8%8E%B7%E5%8F%96-Git-%E4%BB%93%E5%BA%93