git

作者: _前端码农_ | 来源:发表于2019-06-26 23:59 被阅读0次
  • 初始化版本库
    git init
  • 添加文件到暂存区
    git add filename
    git commit -m '描述信息'
  • 查看仓库状态
  • git status 查看状态
  • pwd:显示当前所在目录
  • ll:显示下面的文件详情
  • ls -a :把隐藏目录展示出来
  • echo 'git repo2' >> text.txt 追加文本到文件里。
  • mv text.txt text2.txt 重命名
  • cat test.txt: 展示文件的内容

  • git add bash_demo.txt 需求变更提交到暂存区

  • 取消变更的需求 git reset HEAD bash_demo.txt(从暂存区回退)

  • 清空工作区的文件 git checkout -- bash_demo.txt

  • 添加新需求 git add bash_demo.txt

  • 提交仓库 git commit -m '描述'

  • git log 拿到commit号

  • git reset --hard commit号(从本地分支回退)

  • 情况本地文件 gitrm bash_demo.txt


  • 从远程检出新分支 git checkout -b local_lib_name origin/master
  • 删除远程分支
    1. git push origin --delete Chapater6
    2. git push origin :Chapater8
  • 删除本地分支 git branch -d Chapater8

  • 完全舍弃没有提交的改动 $ git reset --hard HEAD

相关文章

网友评论

      本文标题:git

      本文链接:https://www.haomeiwen.com/subject/dtukcctx.html