git 使用

# 建一个用 git 管理的文件夹
git init
# 设置用户,邮箱
git config --global user.name 'yourname'
git config --global user.email 'youremail'
# 查看配置
git config user.name
# 从服务器 clone 一个现有的项目,可以指定文件名
git clone https://prj_name.git [new_name]
# 从服务器 clone 一个项目的特定分支
git clone --branch=分支名 https://prj_name.git
git clone -b 分支名 https://prj_name.git
# 查看状态
git status
# 查看提交历史
git log
git log --oneline
git log -n2 #只看两行
git log -n2 --oneline
# 创建新分支,不切换分支
git branch [branch-name]
# 查看现有分支
git branch
# 基于 某个分支或 commitid 新建一个分支,并切换到该分支
git checkout -b [branch] [branch/commitid]
# 切换到指定commit
git checkout commitid
# 基于某个 commit 创建新分支
git switch -c newbranch commitid
# 查看 源
git remote -v
# 修改 源
git remote set-url origin URL

参考:

1. Giticon-default.png?t=N7T8https://git-scm.com/

2. Git - Book

3. Git 大全 - Gitee.com

4. 可交互学习环境 Learn Git Branching 

5. git命令-切换分支_木凌的博客-CSDN博客_git切换分支命令

6. Git In The Trenches

7. git config

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值