Git命令簡單使用
背景
最近經(jīng)常使用Github,每次修改個文件代碼都要在網(wǎng)頁端操作,感覺效率低下,所以簡答學習了解了一下Git命令。至使于可以在命令行進行管理Git倉庫,這樣就不需要每次都要打開網(wǎng)頁版Github進行操作。
常用命令使用
# 拉取服務器代碼,更新本地代碼,避免覆蓋他人代碼root@hello:~/Kubernetes# git pull Already up to date.root@hello:~/Kubernetes# # 修改文件root@hello:~/Kubernetes# vim README.md# 將狀態(tài)改變的代碼提交至緩存root@hello:~/Kubernetes# git add .# 查看當前項目中有哪些文件被修改過root@hello:~/Kubernetes# git statusOn branch mainYour branch is up to date with ‘origin/main’.Changes to be committed: (use “git restore –staged …” to unstage) modified: README.mdroot@hello:~/Kubernetes# # 將代碼提交到本地倉庫中root@hello:~/Kubernetes# git commit -m update[main 260d794] update 1 file changed, 25 insertions(+), 25 deletions(-)root@hello:~/Kubernetes# # 將緩存區(qū)代碼推送到遠程倉庫root@hello:~/Kubernetes# git pushUsername for ‘https://github.com’: cby-chenPassword for ‘https://[email protected]’: Enumerating objects: 5, done.Counting objects: 100% (5/5), done.Delta compression using up to 8 threadsCompressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 434 bytes | 434.00 KiB/s, done.Total 3 (delta 2), reused 0 (delta 0), pack-reused 0remote: Resolving deltas: 100% (2/2), completed with 2 local objects.To https://github.com/cby-chen/Kubernetes.git a101d22..260d794 main -> mainroot@hello:~/Kubernetes#
注意
關于
https://www.oiox.cn/
https://www.oiox.cn/index.php/start-page.html
CSDN、GitHub、知乎、微信公眾號、開源中國、思否、掘金、簡書、華為云、阿里云、騰訊云、嗶哩嗶哩、今日頭條、新浪微博、個人博客
全網(wǎng)可搜《小陳運維》
文章主要發(fā)布于微信公眾號