程序员の奇妙冒险

返回
Git Git
2025-04-03 15:23 阅读:100 评论:0

git 常用命令笔记

Git配置 SSH配置 查看提交版本 滚回指定版本 不解决冲突强制推送回退版本到远程 克隆项目 git查看远程仓库地址 修改远程仓库地址 查看所有分支 切换分支 查看当前使用分支(结果列表中前面标*号的表示当前使用分支) 修改当前仓库地址 一次性提交全部分支 一次性推送很多标签 拉去子模块 设置当前

Git配置

1
2
3
4
5
6
Gitgit bash
git config --global user.name
git config --global user.email
 
cat /home/czw/.ssh/id_rsa.pub >> /home/czw/.ssh/authorized_keys

SSH配置

1
2
3
1git bash
2ssh-keygen -t rsa 3使Git id_rsaid_rsa.pubstart ~  .ssh
3cat ~/.ssh/id_rsa.pub  

查看提交版本

1
git log -3

滚回指定版本

1
2
3
git reset --hard e21db9152473821164cd9b2436c9ecf07780cbfa
 
e21db9152473821164cd9b2436c9ecf07780cbfa

不解决冲突强制推送回退版本到远程

1
git push -f

克隆项目

1
git clone

git查看远程仓库地址

1
git remote -v

修改远程仓库地址

1
git remote set-url origin url()

查看所有分支

1
2
3
git branch -a
remotes/origin/my-dev

切换分支

1
git checkout -b my-test origin/my-test

查看当前使用分支(结果列表中前面标*号的表示当前使用分支)

1
git branch

修改当前仓库地址

1
git remote set-url origin http://ip

一次性提交全部分支

1
git push --all origin -u

一次性推送很多标签

1
git push origin --tags

拉去子模块

1
2
1git submodule init
2git submodule update

设置当前代理

1
git config http.proxy http://127.0.0.1:2334

取消当前代理

1
git config --unset http.proxy

取消全局代理

1
git config --global --unset http.proxy

设置socks5代理

1
git config http.proxy socks5://127.0.0.1:10809
评论 (0)
暂无评论 来抢沙发吧~

目录

SpringWonderland

探索 Spring 生态的奇妙世界

2025-04-03 15:23