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

相关推荐
秋月的私语42 分钟前
Windows系统下Git换行符问题的完整解决方案
windows·git
cg50172 小时前
Continue插件实现本地部署一个“cursor”或“github copilot”
github·copilot·curcor
兰舟比特2 小时前
【Git专栏】Git中常用撤回add和commit的指令
git
妙娲种子2 小时前
gittee连接github镜像
gitee·github
无限进步_3 小时前
C语言实现贪吃蛇游戏完整教程【最终版】
c语言·开发语言·c++·git·游戏·github·visual studio
CoderJia程序员甲3 小时前
GitHub 热榜项目 - 日榜(2026-01-21)
ai·开源·大模型·github·ai教程
muddjsv3 小时前
Git 命令全解析:分类、常用命令与实战指南
git
亮子AI3 小时前
【Github】如何取消 issue 自动加入 project 的功能?
github·issue
莫陌尛.4 小时前
git版本提交后撤销
git
徐小夕@趣谈前端4 小时前
【推荐】jitword协同文档新增AI公文助手,一键生成红头文件
vue.js·人工智能·开源·编辑器·github