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 点击

相关推荐
u13013012 分钟前
GitHub 热榜项目:日榜(2026-10-27)
人工智能·github
zroooo1 小时前
GitHub Flow
github
粥里有勺糖2 小时前
视野修炼-技术周刊第137期 | 编程已经面目全非
前端·github·ai编程
miofly2 小时前
GitHub 今日推荐|rea:用 MCP 把反编译器和 AI agent 接到一起的逆向工具
typescript·开源·github
MicrosoftReactor3 小时前
技术速递|超越一刀切:为 GitHub Copilot CLI 和 VS Code 实现决策路由
vscode·ai·github·copilot·决策路由
m4Rk_3 小时前
【论文阅读】Agent 记忆机制(113):Agentic Memory Management——从“检索相关信息”走向“管理 Agent 内部记忆”
论文阅读·人工智能·学习·开源·github
技术达芬奇4 小时前
git bundle介绍
github
暖心hebbie设计学习4 小时前
GitHub 热榜拆解(10.28)|5 个 AI 工具:从设计到写代码,附 issue 区坑点
人工智能·github
逛逛GitHub5 小时前
看这 11 个案例,AI 做游戏真的越来越顶了。
github
前端小万5 小时前
想做个人副业别乱买服务器!我的 5 个月真实开销分享
前端·后端·github