git使用 ---零碎
1.git和svn的区别?
svn又称集中式控制管理,git是分布式控制管理。
svn:集中式,只有一个服务器,因此这样比较安全。但是如果失去了网络,整个就无法工作。
git:每个使用者都有一个本地仓库,没算没有网络,也可以在本地进行版本控制,进行多个版本管理。但是这样不安全,可以拥有全部的代码。
2.git的常用指令
》》git config -l :查看git配置信息

》》设置账号密码
git config --global user.name "wxy"
git config --global user.email "11111@qq.com"
提交文件到暂存区(可指定文件)
git add .
查看暂存区有哪些文件
git status
将暂存区的文件回退(可指定文件回退)
git reset
提交到本地仓库
git commit -m " "
查看分支
git branch -v
创建分支
git branch
切换分支
git checkout 分支名
合并某分支到当前分支:将xxxxx的内容合并到目前的分支
git merge xxxxxx
删除分支:
git branch -d xxxxxx
上传服务器:
git push origin xxxxxx:xxxxxx
主要的还是操作1和4步 推送本地分支local_branch到远程分支 remote_branch并建立关联关系
a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch git push
b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch git push -u origin/remote_branch
c.远程没有有remote_branch分支并,本地已经切换到local_branch git push origin local_branch:remote_branch
===============================================
将本地代码(未git初始化)推送到git上

凭证管理器 可以查看建立的凭证
可以切换并推送

浙公网安备 33010602011771号