Java笔记··By/蜜汁炒酸奶

Git命令小记

Git命令小记

Git

配置

查看git配置

git config -l
1

设置全局参数

git config --global core.autocrlf input 
git config --global core.diff auto
git config --global core.syslinks false
1
2
3

[git] warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF

快速打开git config

git config [--global] --edit
1

Win10下修改git全部配置文件方法
git config命令使用

分支

查看分支

//查看本地和远程所有分支
git branch -a
//查看远程所有分支
git branch -r
//查看本地分支
git branch
1
2
3
4
5
6

git branch用法总结,查看、新建、删除、重命名

重命名分支

重命名本地分支

git branch -m old_local_branch_name new_local_branch_name
1

重命名远程分支

Step1:重命名远程分支对应的本地分支
git branch -m old_local_branch_name new_local_branch_name

step2:删除远程分支
git push origin :old_local_branch_name

step3:重新推送新命名的本地分支
git push origin new_local_branch_name
1
2
3
4
5
6
7
8

git分支重命名 & 删除tag & 删除远程分支后本地依然存在的解决办法

克隆分支

git clone -b 分支名 仓库地址
1

使用git克隆指定分支的代码

git 切换远程分支

//检出并切换分支
git checkout -b feature/training origin/feature/training
1
2

删除远程分支

git branch -r -d origin/branch-name  
git push origin :branch-name
1
2

git命令行删除远程分支

预览
Loading comments...
0 条评论

暂无数据

example
预览