zoukankan      html  css  js  c++  java
  • git学习记录

    git基础
    git的基本操作:初始化仓库,开始或停止跟踪track文件,暂存或提交更改,拉取pull,推送push等。
    1.1初始化仓库:git init
    克隆仓库: git clone
    git的生命周期状态: 未跟踪untrack,未修改unmodified,已修改modified,暂存staged
    未跟踪 --git add--》暂存 --git commit--》未修改 --修改--》已修改 --stage--》暂存
    未跟踪 《----------git rm-------------- 未修改
    1.2检查当前文件状态: git status
    跟踪新文件:git add
    暂存已修改的文件:git add
    忽略文件:.gitignore
    .gitignore 的格式规范如下:
    所有空行或者以 # 开头的行都会被 Git 忽略。
    可以使用标准的 glob 模式匹配。
    匹配模式可以以(/)开头防止递归。
    匹配模式可以以(/)结尾指定目录。
    要忽略指定模式以外的文件或目录,可以在模式前加上惊叹号(!)取反。
    提交更新:git commit
    跳过使用暂存; git commit -a
    移除文件: git rm
    移动文件: git mv
    1.3查看提交历史: git log
    1.4撤消操作:git commit -amend 重新提交
    git reset Head <filename> 取消暂存
    git checkout -- <file> 取消文件的修改
    1.5远程仓库的使用:
    查看远程仓库 git remote
    添加远程仓库 git remote add xx xxxxxxxxx
    拉取仓库中本地没有的信息 git fetch xx
    推送到远程仓库 git push
    查看某个远程仓库 git remote show [remote-name]
    远程仓库的重命名 git remote rename xx yy
    远程仓库的移除 git remote rm
    1.6打标签
    作用;用来标记发布节点
    类型; 轻量标签,附注标签
    查看所有标签: git tag
    创建附注标签: git tag -a xx
    创建轻量标签: git tag xx
    后期打标签; git tag -a xx <hash>
    共享标签; git push origin [tagname] git push origin --tag
    删除标签: git tag -d <tagname>
    检出标签: git checkout <tagname>
    git checkout -b xx <tagname> 检出并创建本地分支
    1.7git别名
    git config --global alias.xx <command>

  • 相关阅读:
    扑克牌顺子
    反转字符串
    左旋转字符串
    和为S的两个数
    C++中substr()详解
    STL库中的equal_range()
    和为S的连续正序列
    数组中只出现一次的数
    二叉树的深度
    mysql找安装路经,更改密码
  • 原文地址:https://www.cnblogs.com/feifei123/p/12206890.html
Copyright © 2011-2022 走看看