Github与本地仓库建立链接、Git命令(或使用Github桌面应用)

一、Git命令(不嫌麻烦可以使用Github桌面应用)

python 复制代码
git clone []    
cd []
git branch -vv  #查看本地对应远程的分支对应关系
git branch -a   #查看本地和远程所有分支
git checkout -b [hongyuan]    #以当前的本地分支作为基础新建一个【】分支,命名为hongyuan
git branch --set-upstream-to=origin/[hongyuan]   #将本地分支与远程【hongyuan】分支进行关联形成关联关系,命名为hongyuan

"""
省略修改代码部分
"""

git status   #本地修改代码保存后,查看修改状态
git diff     #查看修改了啥代码

git add .    #将本地代码全部放到缓存 准备提交
git commit -m "我的修改"   # 本地的【hongyuan】变成了【我的修改】
git status   #查看修改状态
git push     #远程分支代码才会变,之后需要在github的个人分支页面上pull request

二、Github与本地仓库建立链接(方法一)

1 安装好git

2 github上建立新存储库

3 进入本地电脑 项目 文件夹下 右击点开 git bush 终端,依次输入:

python 复制代码
git init
git add .       #改动下
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/hongyuanbug/1.git
git push -u origin main

三、Github与本地仓库建立链接(方法二)

1 进入Github桌面应用

2 点击

相关推荐
i学长的猫4 小时前
obsidian md github站点
github
jack@london5 小时前
使用Railway
github
红豆子不相思6 小时前
Tomcat 环境搭建与集群实战
服务器·git·tomcat
杰哥技术分享7 小时前
Git 仓库迁移技术文档:从 CODING.net 迁移至腾讯云 CNB
git
给老吕螺丝8 小时前
提升国内访问GitHub稳定性的解决方案:Steamcommunity 302工具详解 (Ver.13.0.05+)
经验分享·github
阿里嘎多学长8 小时前
2026-02-25 GitHub 热点项目精选
开发语言·程序员·github·代码托管
梅孔立8 小时前
Ansible 100 台服务器一键管控实战 进阶版
服务器·git·ansible
黑白极客8 小时前
ACP大模型认证刷题工具开源,助力高效备考
java·ai·github·llama·认证
无限进步_10 小时前
138. 随机链表的复制 - 题解与详细分析
c语言·开发语言·数据结构·算法·链表·github·visual studio
AI大模型..15 小时前
Dify 本地部署安装教程(Windows + Docker),大模型入门到精通,收藏这篇就足够了!
人工智能·程序员·开源·llm·github·deepseek·本地化部署