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 你的分支名称
相关推荐
2***B44919 分钟前
C++在金融中的QuantLibXL
开发语言·c++·金融
A***071733 分钟前
C++在游戏中的阴影渲染
开发语言·c++·游戏
Salt_07281 小时前
DAY 19 数组的常见操作和形状
人工智能·python·机器学习
无心水2 小时前
【Python实战进阶】2、Jupyter Notebook终极指南:为什么说不会Jupyter就等于不会Python?
python·jupyter·信息可视化·binder·google colab·python实战进阶·python工程化实战进阶
Q***l6872 小时前
C++在计算机图形学中的渲染
开发语言·c++
oioihoii2 小时前
C++语言演进之路:从“C with Classes”到现代编程基石
java·c语言·c++
徐小夕2 小时前
耗时一周,我把可视化+零代码+AI融入到了CRM系统,使用体验超酷!
javascript·vue.js·github
咔咔咔的2 小时前
3190. 使所有元素都可以被 3 整除的最少操作数
c++
天庭鸡腿哥2 小时前
吾爱3年前的作品,依旧流批!
科技·microsoft·visual studio·everything
逛逛GitHub2 小时前
5 个 AI 操纵手机的 GitHub 项目,太强了
github