git初始

第一次学习git,感觉多用还是很简单的呢,接下来稍微写一下主要的命令吧。

  1. git init 初始化.git文件夹
  2. git add . 将全部文件夹都添加到暂存区
  3. git add 文件夹名 将某个具体文件夹添加到暂存区
  4. git commit -m "注解" 将暂存区的推送到远端 git commit -m '注解' --no-verify 不做校验,将暂存区的推送到远端
  5. git reset --hard commit_id 回退到指定版本,commit_id是版本号
  6. git log 查看提交历史,确定回退到那个版本
  7. git reflog 查看命令历史,确定回到未来的那个版本
  8. git checkout -- file 将某个文件回退到修改之前
  9. git rm file 删除文件
  10. git status 查看保存之前与现在的区别
  11. git branch 查看分支
  12. git branch 创建分支
  13. git checkout 或者 git switch -c 创建+切换分支
  14. git merge 合并某分支到当前分支
  15. git branch -d 删除分支
  16. git log --graph 查看分支合并图
  17. git stash 将当前工作现场"储藏"起来,等以后恢复现场继续工作
  18. git stash pop 将之前"储藏"的工作现场恢复
  19. git checkout master 切换到主分支
  20. git remote -v 查看远程库信息
  21. git push origin branch-name 从本地推送分支到远程仓库
  22. git pull 从远程抓取分支
posted @ 2021-12-08 11:15  卿六  阅读(43)  评论(0编辑  收藏  举报