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
相关推荐
Slow菜鸟1 分钟前
Git Worktree 使用教程
大数据·git·elasticsearch
阿民不加班15 小时前
【Git】git拉取远端但是本地存在不想提交文件处理
git
Selina K16 小时前
在windows安装git
git
周杰伦fans1 天前
如何将 Feature 分支同步到 Master 主分支:一次完整的 Git 合并实战
git
jiayi_19991 天前
git创建new branch
git
__Witheart__1 天前
通过交互式 Rebase 合并部分提交到远程分支的操作步骤
git
魔都吴所谓1 天前
【Tools】Repo 工具完整使用手册
git
tianyuanwo1 天前
跨 Gerrit 项目迁移分支并保留完整历史:一份可操作的 Git 指南
git·代码迁移
玄奕子1 天前
VS Code 上传 GitHub 全流程(Windows 环境):HTTP 与 SSH 两种方案(含常见报错排查)
git·http·ssh·github·嵌入式开发
一只游鱼1 天前
如何让本地的敏感配置文件不上传到git仓库
git·elasticsearch