使用命令行管理git项目

初始化一个新的Git仓库

git init

添加文件到暂存区

git add <file>

提交暂存区的更改到仓库

git commit -m "commit message"

查看当前仓库的状态

git status

查看提交历史

git log

查看文件的改动

git diff <file>

创建一个新分支

git branch <branch-name>

切换到一个已存在的分支

git checkout <branch-name>

合并分支

git merge <branch-name>

删除分支

git branch -d <branch-name>

推送到远程仓库

git push <remote> <branch>

拉取远程仓库的更改

git pull <remote> <branch>

克隆远程仓库到本地

git clone <repository>

添加远程仓库地址

git remote add <remote> <url>

拉取所有远程分支的更新

git fetch --all

设置Git的用户名和邮箱

git config --global user.name "Your Name"

git config --global user.email "your.email@example.com"

使用命令行管理git项目 设置tag

复制代码
git tag -a v1.0.0 -m "My version 1.0.0"
相关推荐
曲幽7 小时前
FastAPI + PostgreSQL 实战:给应用装上“缓存”和“日志”翅膀
redis·python·elasticsearch·postgresql·logging·fastapi·web·es·fastapi-cache
武子康11 小时前
大数据-244 离线数仓 - Hive ODS 层建表与分区加载实战(DataX→HDFS→Hive)
大数据·后端·apache hive
Elasticsearch1 天前
为上下文工程构建高效的数据库检索工具
elasticsearch
武子康1 天前
大数据-243 离线数仓 - 实战电商核心交易增量导入(DataX - HDFS - Hive 分区
大数据·后端·apache hive
今日无bug1 天前
Git 提交:用全栈技术打造智能 Commit Message 生成器
git·全栈
明月_清风2 天前
拒绝盲目 Git:VS Code 神级插件 GitLens 的 9 个进效杀手锏
前端·git
代码匠心3 天前
从零开始学Flink:Flink SQL四大Join解析
大数据·flink·flink sql·大数据处理
goodspeed4 天前
Git Worktree:多分支并行开发的利器
git·github
武子康4 天前
大数据-242 离线数仓 - DataX 实战:MySQL 全量/增量导入 HDFS + Hive 分区(离线数仓 ODS
大数据·后端·apache hive
Elasticsearch4 天前
需要知道某个同义词是否实际匹配了你的 Elasticsearch 查询吗?
elasticsearch