关于git的使用记录总结

1.解决Windows下git换行符报警问题

git config --global core.autocrlf false

2.撤销add的文件退出暂存区

git reset --mixed

 3.git拉下来所有的分支

git pull

4.git查看所有的分支

git branch -a

5.git切换到某一个分支

git checkout 分支名称

 6.重新编辑git commit的备注信息(会进入vim环境,之后修改备注信息)

git commit -amend

 7.git推送到远程仓库总是需要输入用户名密码

git config --global credential.helper store

 8.git创建分支

git branch 分支名称

 9.git查看所有远程仓库地址

git remote -v

10.git删除某一远程分支

git remote rm 名称(比如说origin)

 11.git推送本地分支到远程分支(默认在远程创建分支)

git push origin 已经创建的本地分支名称:远程分支名称

 12.git检出某一个远程分支到本地分支

git checkout -b 本地分支名称 origin/远程分支名称

 13.git删除本地分支

git branch -d 本地分支名称

14.git删除远程分支

git push origin --delete 远程分支名称

 15.git合并分支到当前分支(首先要切换到待合并的分支)

git merge 需要合并到当前分支的目标分支名称

16.git用checkout创建并切换分支

git checkout -b 分支名称

 

原文地址:https://www.cnblogs.com/jimaojin/p/8818003.html