Git命令:常用Git命令集合
生活随笔
收集整理的這篇文章主要介紹了
Git命令:常用Git命令集合
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.Git基本工作流程
?2.命令
| git init | 初始化,創建 git 倉庫 |
| git status | 查看 git 狀態 (文件是否進行了添加、提交操作) |
| git add 文件名 | 添加,將指定文件添加到暫存區 |
| git commit -m '提交信息' | 提交,將暫存區文件提交到歷史倉庫 |
| git log | 查看日志( git 提交的歷史日志) |
歷史版本切換:
git reflog git reset --hard 版本唯一索引值?
分支管理操作:
- 創建和切換創建命令:git branch 分支名 切換命令:git checkout 分支名 - 新分支添加文件查看文件命令:ls總結:不同分支之間的關系是平行的關系,不會相互影響 - 合并分支合并命令:git merge 分支名 - 刪除分支刪除命令:git branch -d 分支名 - 查看分支列表查看命令:git branch遠程倉庫工作流程(理解)
?
楊路恒@WIN-S5E6V36PP3P MINGW64 /d/Java $ git add 張穎 fatal: not a git repository (or any of the parent directories): .git楊路恒@WIN-S5E6V36PP3P MINGW64 /d/Java $ git init Initialized empty Git repository in D:/Java/.git/楊路恒@WIN-S5E6V36PP3P MINGW64 /d/Java (master) $ git add 張穎 warning: adding embedded git repository: 張穎 hint: You've added another git repository inside your current repository. hint: Clones of the outer repository will not contain the contents of hint: the embedded repository and will not know how to obtain it. hint: If you meant to add a submodule, use: hint: hint: git submodule add <url> 張穎 hint: hint: If you added this path by mistake, you can remove it from the hint: index with: hint: hint: git rm --cached 張穎 hint: hint: See "git help submodule" for more information.楊路恒@WIN-S5E6V36PP3P MINGW64 /d/Java (master) $ git commit -m '張穎' [master d755aaf] 張穎1 file changed, 1 insertion(+)create mode 160000 "\345\274\240\351\242\226"楊路恒@WIN-S5E6V36PP3P MINGW64 /d/Java (master) $ git push -u origin master Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Delta compression using up to 4 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 312 bytes | 312.00 KiB/s, done. Total 2 (delta 0), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.0] To gitee.com:lhyoungxy/zhangying.git73067e1..d755aaf master -> master從遠程倉庫復制到本地倉庫:
git clone git@gitee.com:lhyoungxy/zhangying.gitgit pull git@gitee.com:lhyoungxy/zhangying.git總結
以上是生活随笔為你收集整理的Git命令:常用Git命令集合的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux关闭Tomcat服务器出现无法
- 下一篇: 人工智能支撑马赛克战机理研究