Git入门详解

Git入门详解

1. Git安装

2. Git配置

简易的命令行入门教程:

  • Git 全局设置:
bash 复制代码
git config --global user.name "yourname"
git config --global user.email "your email"

3. Git使用

  • 创建 git 仓库:
bash 复制代码
mkdir circular_spot_detect
cd circular_spot_detect
git init 
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/start_2022/circular_spot_detect.git
git push -u origin "master"
  • 已有仓库?
bash 复制代码
cd existing_git_repo
git remote add origin https://gitee.com/start_2022/circular_spot_detect.git
git push -u origin "master"
  • 若想维护自己的仓库或者更新代码

    • 如果是在新的电脑上进行更新,则需要:
    bash 复制代码
    #第一次需要下载代码,下载链接即HTTPS链接
    git clone xxxxx.git 
    
    #然后进行代码或者文件的增加与删减
    -------
    • 更新代码
    bash 复制代码
     #每次上传时需要先pull一下
    git pull 
     
    #然后添加更改
    git add .
    #添加合并注释
    git commit -m "更改了。。。"
    
    #上传:
    git push
  • 上传代码到分支 branch

bash 复制代码
#查看一下分支结构
git branch

#如果没有你自己的分支,新建分支
git checkout -b 分支名称

#已有分支,切换到当前分支
git checkout 分支名称

#将要上传的文件提交
git add .

#提交文件
git commit -m '提交的描述'

#push到远程仓库
git push origin 你的分支名称
相关推荐
情缘晓梦.6 分钟前
C++ 内存管理
开发语言·jvm·c++
恒者走天下19 分钟前
研一、大一大二学计算机应该怎么规划
c++
长行36 分钟前
Python|Windows 安装 DeepSpeed 安装方法及报错 Unable to pre-compile async_io 处理
windows·python·deepspeed
百锦再36 分钟前
python之路并不一马平川:带你踩坑Pandas
开发语言·python·pandas·pip·requests·tools·mircro
Python之栈36 分钟前
5款拖拽式Python GUI生成器助你快速打造炫酷界面
python
灏瀚星空36 分钟前
基于 Python 与 GitHub,打造个人专属本地化思维导图工具全流程方案(上)
开发语言·人工智能·经验分享·笔记·python·个人开发·visual studio
用什么都重名36 分钟前
「实战指南」使用 Python 调用大模型(LLM)
python·大模型·llm·api调用
是Dream呀37 分钟前
Python从0到100(一百):基于Transformer的时序数据建模与实现详解
开发语言·python·transformer
资源存储库37 分钟前
【笔记】如何修改一个conda环境的python版本?
笔记·python·conda
xcLeigh37 分钟前
AI的提示词专栏:Prompt 与 Python Pandas 的结合使用指南
人工智能·python·ai·prompt·提示词