zoukankan      html  css  js  c++  java
  • git and github 使用之个人

    配置信息 git config --global user.name git config --global user.email

    git status

    提交 git add filename(工作区提交到缓存区) git add .提交所有文件 git commit(缓存区提交到版本库,会打开记事本写注释) git commit -m直接写注释 git commit -a -m先提交到暂存区,再到版本库

    git log 按q退出

    对比 git diff(工作区与缓存区的对比) git diff --cached(缓存区与版本库的对比) git diff master(工作区与版本库的对比)

    撤销 git reset HEAD filename(缓存区还原工作区) git checkout -- filename(Z工作区还原) git commit --amend(撤销上次提交,合并提交)

    删除 git rm filename(删除缓存区的文件,但要先删除工作区的文件) git rm -f filename(直接删除缓存区和工作区的文件) git rm --cached filename(删除缓存区的文件,保留工作区的)

    还原 git checkout commitid filename还原单个 git reset --hard commitid还原所有 git reset --hard HEAD^自动还原上个版本 git reset --hard HEAD~数字 还原指定版本 git reflog 查看最近的动作

    同步到远程仓库 git remote查看仓库名字 git remote -v 查看仓库对应的名字 git push name master(分支)

    拉取仓库 git clone url

    多人协作解决冲突 git fetch不自动合并 git diff master origin/master git merge origin/master合并 git pull自动合并

    开源项目协作 fork克隆一个版本,放到自己的名下 pull request

    git分支 git branch查看分支 git branch new1创建分支 git checkout new1切换分支 git checkout -b new2创建分支并企切换 git merge new1

    git branch --merged查看分支合并情况 git branch --no-merged查看没有分支合并情况 git branch -d new1删除分支,要这个分支先合并 git branch -D new1删除分支,这个分支可以没有分支

    git标签 git tag v1.0打标签

  • 相关阅读:
    method-r
    dtrace
    轻用其芒,动即有伤,是为凶器;深藏若拙,临机取决,是为利器!
    Git---报错:git Please move or remove them before you can merge 解决方案
    Git----拉取远程分支,git pull,git rebase,git pull --rebase的区别
    Git----查看提交日志
    Git---tag
    Git----常见工作管理总结
    【线上监控】日志上报bug处理方式总结
    接口文档所需内容
  • 原文地址:https://www.cnblogs.com/masita/p/5185689.html
Copyright © 2011-2022 走看看