git 使用记录

远程仓库为空初始化

初始化本地仓库

复制代码
git init 

在本地仓库书写代码(这里可以编辑一个文本文件做测试,如hello.txt)

复制代码
执行:git add 要让git管理的文件(git add hello.txt)
			
	=>执行完此操作将我们的hello.txt保存到了暂存区

执行:git commit -m '备注信息'

	=>执行此操作将我们的文件提交到了本地仓库

执行:git remote add origin 自己的仓库地址(如:git remote add origin https://gitee.com/currygl/ttt.git)

	=>执行此操作将我们的远程仓库和本地仓库绑定(只需要绑定一次,后面的修改提交就不需要了)

git push -u origin master

	=>执行此操作将本地仓库的文件推送到远程仓库

如果远程仓库已有内容

初始化本地仓库

复制代码
git init 

将本地代码库与远程代码库相关联

复制代码
$ git remote add origin https://gitee.com/qlqaq/projects/仓库名称

把远程仓库的代码更新到当前分支上面

复制代码
$ git pull --rebase origin master
复制代码
git add 文件名
git commit -m ""

将本地代码推送到指定远程的仓库中

复制代码
$ git push -u origin master

参考文章

https://www.cnblogs.com/xyfer1018/p/11493718.html

https://blog.csdn.net/qq_38215042/article/details/109406958

删除文件

复制代码
rm 文件名
git commit -m ""
git push
相关推荐
vistaup2 小时前
windows git 更新当前目录下所有的文件(非递归)
windows·git
王码码20353 小时前
Flutter for OpenHarmony:Flutter 三方库 algoliasearch 毫秒级云端搜索体验(云原生搜索引擎)
android·前端·git·flutter·搜索引擎·云原生·harmonyos
Irene19917 小时前
Git 命令汇总表(基于一次完整的 Git 实战经验整理,涵盖从安装配置到日常开发、问题排查的所有常用命令)
git·常用命令
q5431470877 小时前
Redis Desktop Manager(Redis可视化工具)安装及使用详细教程
redis·git·bootstrap
素雨迁喜9 小时前
Linux平台下git工具的使用
linux·运维·git
Irene199111 小时前
Windows环境,VS Code 中 Git 配置指南
git·基础配置
Yang-Never12 小时前
AI Code -> Windows电脑安装Claude
开发语言·windows·git
Irene199112 小时前
2026 前端开发 Windows 安装 Git 配置指南(有实际安装过程参考:适配版本 the latest 2.53.0(2) x64 )
前端·windows·git
早起的年轻人12 小时前
告别Git仓库臃肿:一招解决Maven target目录误提交问题
java·git·maven
悠然大月季1 天前
git 怎么导出提交历史,文件是乱码
git·git导出历史记录·git导出历史乱码