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

相关推荐
醇氧17 小时前
【git】WARNING: connection is not using a post-quantum key exchange algorithm.
git
一只程序熊18 小时前
Git不常用操作记录
git
通义灵码18 小时前
Qoder 支持通过 DeepLink 添加 MCP Server
人工智能·github·mcp
小龙18 小时前
【Git 报错解决】 远程仓库 origin 已存在(`remote origin already exists`)
git·报错
数据大魔方1 天前
【期货量化实战】跨期套利策略:价差交易完整指南(TqSdk源码详解)
数据库·python·算法·github·程序员创富
数据大魔方1 天前
【期货量化实战】螺纹钢量化交易指南:品种特性与策略实战(TqSdk完整方案)
python·算法·github·程序员创富·期货程序化·期货量化·交易策略实战
Cx330❀1 天前
Git 多人协作全攻略:从入门到高效协同
大数据·elasticsearch·搜索引擎·gitee·github·全文检索·gitcode
BORN(^-^)1 天前
Git 操作概要
git
CoderJia程序员甲1 天前
GitHub 热榜项目 - 日榜(2026-1-9)
开源·大模型·llm·github·ai教程
bigHead-1 天前
Git合并操作详解:安全高效地合并远程分支
git·安全·elasticsearch