详解 diff commit htm -a 笔记 hub .net 回滚
之前使用git一直用sourceTree可视化操作,直到今天刚好装不了sourceTree,所有只能苦逼的用git命令行了,真的一片空白,要做下笔记才行。
创建sshKey
- 创建ssh:
- ssh-keygen -t rsa -C "xxxxxx@qq.com"
- 查看ssh
- cat ~/.ssh/id_rsa.pub
在电脑上创建一个文件夹,先Clone一份自己工程的项目分支(xxx屏蔽公司信息)
- git clone git@xxxx.gitlab.com: xxxxxx / SELand_Vertu
进入项目的二级目录进入git客户端,确认要pull分支
- git branch看看当前的分支
- git checkout - b develop切换到develop分支,因为我要pull拉去develop分支上的项目
然后在将自己的项目分支同步项目主分支(我们项目分支为develop分支)
- git pull git@xxx.gitlab.com: xxx / SELand_Vertu develop
每次提交代码时候,需要先同步项目主分支代码
- git status是哪些文件有所修改
- git diff可以查询所修改的代码
- git add - A增加自己所做的修改
- git commit - a提交所有修改的代码
- git push origin develop提交代码
常用流程
- git status查看修改过的文件
- git add.选择文件
- git commit - m "提交的信息"备注
- git pull origin master同步线上代码到本地
- git push origin master本地代码推送到线上
- git reset--hard HEAD~1回滚上一个版本
详解:https://www.cnblogs.com/mengdd/p/4153773.html
阿里云code:http://blog.csdn.net/dark00800/article/details/54571859
解决github上传ssh-key后仍须输入密码的问题:http://blog.csdn.net/baidu_35085676/article/details/53456884
真正入坑git
详解 diff commit htm -a 笔记 hub .net 回滚
原文:http://www.cnblogs.com/cxscode/p/7805909.html
来源: http://www.bubuko.com/infodetail-2386460.html