Git控制指令

  1. git status查看当前本地分支的修改状态

  2. git diff 文件路径 查看具体文件的修改内容

  3. git log打印用户信息

  4. git remote -v查看远程地址

  5. git checkout -- *还原被删除的文件

  6. git rm -r --force .删除本地所有文件

  7. git commit -m "Remove all files from repository"提交所有代码

  8. git clone 克隆项目

  9. git remote add 添加远程地址

  10. git add 添加所有文件

  11. git push -u origin master 推送

  12. git log 分页 or 退出

  • 如果 git log 的输出比屏幕还要长,通常会使用像 less 或 more 这样的分页器来显示。在这种情况下,你可以按下 Q键来退出。
  • 如果使用的是 less,按下 Q 键。
  • 如果使用的是 more,按下 Space 键(按一次一页)或者 Q 键。
  1. repo 使用
    初始化仓库
    repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest

    下载单仓
    repo sync platform/frameworks/base
    repo sync platform/frameworks/native
    repo sync packages/apps/Launcher3
    repo sync packages/apps/Settings

参看对应分支
cd manifest
git branch 查看当前分支
git branch -a 查看所有分支
git branch -a |grep android11-
切换分支
git checkout -b android-8.0.0_r17 origin/android-8.0.0_r17

14 .git撤销文件修改
git checkout -- 文件名

15 .撤销到最近一次的提交
git reset --hard HEAD

相关推荐
醇氧6 小时前
【git】WARNING: connection is not using a post-quantum key exchange algorithm.
git
一只程序熊7 小时前
Git不常用操作记录
git
小龙7 小时前
【Git 报错解决】 远程仓库 origin 已存在(`remote origin already exists`)
git·报错
BORN(^-^)15 小时前
Git 操作概要
git
bigHead-18 小时前
Git合并操作详解:安全高效地合并远程分支
git·安全·elasticsearch
C_心欲无痕18 小时前
ts - 交叉类型
前端·git·typescript
秋饼20 小时前
【K8S测试程序--git地址】
git·容器·kubernetes
小龙1 天前
【Git 报错解决】本地无有效提交无法推送(`src refspec main does not match any`)
git·github·报错
小扶苏1 天前
删除git全局账号信息并设置成新的账号密码命令
git
Greg_Zhong1 天前
Git创建任务分支进行开发,最后合并主分支master【纯git命令执行过程】阐述
git