博客
关于我
Git常用命令行
阅读量:169 次
发布时间:2019-02-28

本文共 745 字,大约阅读时间需要 2 分钟。

Git 常用命令及操作指南

1. Git 配置

在使用 Git 前,首先需要配置用户信息:

git config --global user.name "用户名"git config --global user.email "用户邮箱"

2. 创建及初始化仓库

新建一个目录并初始化 Git 仓库:

mkdir dir_namegit init

添加当前目录下的所有文件:

git add .

3. 文件管理

查看当前仓库状态:

git status

添加指定文件:

git add index.js

提交文件并添加注释:

git commit -m "注释信息"

撤销最近的提交:

git reset --soft HEAD~1

4. 文件删除

删除本地文件夹:

git rm -rf "文件夹名"

提交文件删除操作:

git add -agit commit -m "删除文件夹"

删除远程仓库文件:

git rm "文件名"

5. 远程仓库操作

添加远程库:

git remote add origin "远程仓库地址"

移除远程库:

git remote remove origin

查看远程库:

git remotegit remote -v

重命名远程库:

git remote rename origin new-origin

6. 分支操作

查看现有分支:

git branch

创建新分支:

git branch fenzhi

切换分支:

git checkout fenzhi

切换回主分支:

git checkout master

合并分支:

git merge fenzhi

以上命令是 Git 的常用操作指南,熟悉这些命令可以帮助您更高效地进行代码管理和版本控制。

转载地址:http://bcpc.baihongyu.com/

你可能感兴趣的文章
Objective-C实现chudnovsky algorithm楚德诺夫斯基算法(附完整源码)
查看>>
Objective-C实现CIC滤波器(附完整源码)
查看>>
Objective-C实现circle sort圆形排序算法(附完整源码)
查看>>
Objective-C实现CircularQueue循环队列算法(附完整源码)
查看>>
Objective-C实现clearBit清除位算法(附完整源码)
查看>>
Objective-C实现climbStairs爬楼梯问题算法(附完整源码)
查看>>
Objective-C实现cocktail shaker sort鸡尾酒排序算法(附完整源码)
查看>>
Objective-C实现cocktailShakerSort鸡尾酒排序算法(附完整源码)
查看>>
Objective-C实现CoinChange硬币兑换问题算法(附完整源码)
查看>>
Objective-C实现collatz sequence考拉兹序列算法(附完整源码)
查看>>
Objective-C实现Collatz 序列算法(附完整源码)
查看>>
Objective-C实现comb sort梳状排序算法(附完整源码)
查看>>
Objective-C实现combinationSum组合和算法(附完整源码)
查看>>
Objective-C实现combinations排列组合算法(附完整源码)
查看>>
Objective-C实现combine With Repetitions结合重复算法(附完整源码)
查看>>
Objective-C实现combine Without Repetitions不重复地结合算法(附完整源码)
查看>>
Objective-C实现conjugate gradient共轭梯度算法(附完整源码)
查看>>
Objective-C实现connected components连通分量算法(附完整源码)
查看>>
Objective-C实现Connected Components连通分量算法(附完整源码)
查看>>
Objective-C实现Convex hull凸包问题算法(附完整源码)
查看>>