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 你的分支名称
相关推荐
hu_yuchen3 分钟前
问卷系统自动化测试报告
软件测试·python
这儿有一堆花3 分钟前
C语言递归宏详解
c语言·开发语言·c++
百锦再23 分钟前
第8章 模块系统
android·java·开发语言·python·ai·rust·go
吃饺子不吃馅25 分钟前
⚡️ Zustand 撤销重做利器:Zundo 实现原理深度解析
前端·javascript·github
ue星空29 分钟前
全局描述符表GDT (Global Descriptor Table)
c++
Ashlee_code36 分钟前
经纪柜台系统解析:从今日国际金融动荡看证券交易核心引擎的变革
python·架构·系统架构·区块链·vim·柜台·香港券商
oioihoii1 小时前
C++中的多态:动态多态与静态多态详解
java·开发语言·c++
清空mega1 小时前
从零开始搭建 flask 博客实验(4)
后端·python·flask
whysqwhw1 小时前
KMP类GSON转字符串工具
github
TinyPiXOS开发者联盟1 小时前
轻量级嵌入式系统的 Lottie 动画实现
linux·c++·动画·嵌入式开发·lottie·tinypixos·tpgui