当前位置: 首页 > Linux

Git命令简单易用

时间:2023-04-06 12:04:48 Linux

Git命令简单易用背景最近经常使用Github。每次修改一个文件代码,都要在网页上操作,感觉效率低下,所以用简答的方式学习了一下Git命令。至于命令行管理Git仓库的能力,就不用每次都打开网页版的Github来操作了。常用命令用#拉取服务器代码,更新本地代码,避免覆盖别人的代码~/Kubernetes#vimREADME.md#提交状态改变代码到缓存root@hello:~/Kubernetes#gitadd.#查看当前项目有哪些文件被修改root@hello:~/Kubernetes#gitstatusOnbranchmainYourbranchisuptodatewith'origin/main'.要提交的更改:(使用“gitrestore--staged...”取消暂存)修改:README.mdroot@hello:~/Kubernetes##将代码提交到本地仓库root@hello:~/Kubernetes#gitcommit-mupdate[main260d794]update1个文件更改,25个插入(+),25个删除(-)root@hello:~/Kubernetes##推送缓冲区代码进入远程仓库root@hello:~/Kubernetes#gitpushUsernamefor'https://github.com':cby-chenPasswordfor'https://cby-chen@github.com':Enumeratingobjects:5,完成。计数对象:100%(5/5),完成。使用最多8个线程进行增量压缩压缩对象:100%(3/3),完成。写入对象:100%(3/3),434字节|434.00KiB/s,完成。总计3(三角洲2),reused0(delta0),pack-reused0remote:Resolvingdeltas:100%(2/2),用2个本地对象完成。到https://github.com/cby-chen/Kubernetes.gita101d22。.260d794main->mainroot@hello:~/Kubernetes#注意推送的时候需要输入token。这个token需要在:https://github.com/settings/t...创建GitHub的README.md文件如果你觉得gitadd提交缓存的过程太繁琐,Git也允许你跳过这一步加上-a选项。命令格式如下:gitcommit-a关于https://www.oiox.cn/https://www.oiox.cn/index.php...CSDN、GitHub、知乎、微信公众号、打开来源中国、师傅、掘金、简书、华为云、阿里云、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客、网络可搜索《小陈运维》文章主要发表在微信上公众号