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 你的分支名称
相关推荐
GHL2842710908 分钟前
用PDH库获取CPU使用率(源码)
c++
让我们一起加油好吗9 分钟前
【基础算法】多源 BFS
c++·算法·bfs·宽度优先·多源bfs
冷崖13 分钟前
定时器的学习(二)
linux·c++·学习
B站计算机毕业设计之家15 分钟前
深度学习实战:python动物识别分类检测系统 计算机视觉 Django框架 CNN算法 深度学习 卷积神经网络 TensorFlow 毕业设计(建议收藏)✅
python·深度学习·算法·计算机视觉·分类·毕业设计·动物识别
大胆飞猪17 分钟前
高并发内存池日志
c++·项目
程序猿小D21 分钟前
【完整源码+数据集+部署教程】 【运输&加载码头】仓库新卸物料检测系统源码&数据集全套:改进yolo11-DRBNCSPELAN
python·yolo·计算机视觉·目标跟踪·数据集·yolo11·仓库新卸物料检测系统
whysqwhw28 分钟前
KSP 全面讲解
github
想唱rap32 分钟前
C++ string类的使用
开发语言·c++·笔记·算法·新浪微博
胖咕噜的稞达鸭32 分钟前
C++中的父继子承(2)多继承菱形继承问题,多继承指针偏移,继承组合分析+高质量习题扫尾继承多态
c语言·开发语言·数据结构·c++·算法·链表·c#
SiYuanFeng33 分钟前
《Synthetic Visual Genome》论文数据集的预处理
python·场景图