My learn of git
2015-06-11 22:34
302 查看
我的git最开始是在廖雪峰git教程学习的。
然后就可以在右键菜单里面发现git bash的选项了。
然后是
这个设置很重要哦@O_O@/
然后可以在这个文件夹里面做一些事情,例如写一些代码什么的。。
接下来的命令就是
我一般直接用
菜鸟无需知道太多技巧,用多了以后慢慢就知道了。。
首先,用
生成的时候所有的选择都选择默认,看到下面的内容的时候说明生成成功了。
用记事本打开id_rsa.pub(公钥),把文件内容复制到github的-用户设置-SSHkeys-addkey里面。
这样之后在往github上push你的repo就不需要再输入账号密码。
当然是弄个pages博客啦啦啦。
首先去找一个模板吧,去github的搜索框里面搜jekyll关键字!!
嘎嘎嘎一堆模板出来了。
然后clone到你的电脑吧。
再然后新建一个名字叫做yourusername.github.io的repo吧。
然后把你在第二步里面clone下来的repo名字改成yourusername.github.io吧
把修改好的repo push到你的github里面吧!!
然后在浏览器地址栏里面输入yourusername.github.io看看效果吧。
给你的博客修改样式,添加文章吧。
我的git学习之路大致就是这样的了。 还有就是,如果想用github的pages搭建博客,markdown不能不学啊。
当然,知道一些基础的语法就可以了,不需要学的很深入。markdown的学习可以穿插在写博客文章的中间,慢慢学。
程序猿,你要学的东西还很多,慢慢学吧。
——-update at 2015-06-03 08:50
安装git
我的git是在github 下载的mysysgit 然后打开安装包,一路点下去就好了。然后就可以在右键菜单里面发现git bash的选项了。
学习基本的git命令
我第一个学会的命令是git init
然后是
git config命令
git config --global user.name "sparkrat" git config --global user.email "sparkrat@163.com"
这个设置很重要哦@O_O@/
然后可以在这个文件夹里面做一些事情,例如写一些代码什么的。。
接下来的命令就是
git add和
git commit了
我一般直接用
git add --all git commit -m "a hint message"
菜鸟无需知道太多技巧,用多了以后慢慢就知道了。。
一些必须掌握的命令
然后我现在还掌握的命令有git status git rm < a file > git checkout -- < a file > git clone remoteReponame git remote add remoteReponame remoteRepoAddress # remoteRepoAddress 可以有多种协议,最常用的有两种: # 使用https协议: https://github.com/username/reposityName.git # 使用ssh协议: git@github.com:username/reposityName.git git push remoteReponame brachName git remote remove remoteReponame git reset --hard HEAD(^(^(^))) git log (--pretty=oneline) git reflog (--pretty=oneline)
使用sshkey让push更方便
还有,不得不说的一件事就是,一开始我一直用的https协议进行push的,但是这样麻烦死人。因为每次都需要输github账号密码。后来我发现,用shh协议可以想push就push。。炒鸡方便嗄。首先,用
ssh-keygen -t rsa -C "youremail@example.com"生成一个rsa文件,在用户文件夹的.ssh文件夹(好像是隐藏文件夹)里面。
生成的时候所有的选择都选择默认,看到下面的内容的时候说明生成成功了。
用记事本打开id_rsa.pub(公钥),把文件内容复制到github的-用户设置-SSHkeys-addkey里面。
这样之后在往github上push你的repo就不需要再输入账号密码。
用git pages搭建博客
学会用git和github的remoteRpo之后,用它来干点什么呢?当然是弄个pages博客啦啦啦。
首先去找一个模板吧,去github的搜索框里面搜jekyll关键字!!
嘎嘎嘎一堆模板出来了。
然后clone到你的电脑吧。
再然后新建一个名字叫做yourusername.github.io的repo吧。
然后把你在第二步里面clone下来的repo名字改成yourusername.github.io吧
把修改好的repo push到你的github里面吧!!
然后在浏览器地址栏里面输入yourusername.github.io看看效果吧。
给你的博客修改样式,添加文章吧。
我的git学习之路大致就是这样的了。 还有就是,如果想用github的pages搭建博客,markdown不能不学啊。
当然,知道一些基础的语法就可以了,不需要学的很深入。markdown的学习可以穿插在写博客文章的中间,慢慢学。
程序猿,你要学的东西还很多,慢慢学吧。
update
the new command I learned
git checkout -b newbranch //create a new branch and switch to it //it also equal to the next two command git branch newBranchName //create a new branch git chekcout branchName //switch to a brach git remote show remotereponame //see the details of remote repo git merge branchName //merge a branch to current brach
——-update at 2015-06-03 08:50
相关文章推荐
- 线程创建的方法(继承与接口)
- viewpager+Fragment结构,Fragment嵌套的Fragment显示不出来
- leetcode 020 Valid Parentheses(Python)
- 青岛市赛总结——远征石油大学
- 百度之星2015初赛(1)1003 HDOJ5248 序列变换(二分 贪心)
- Ubuntu搜狗输入法安装
- android 抽屉式侧滑菜单
- Javascript中构造函数的返回值问题和new对象的过程
- AI 笔记(一)
- 分层
- 学习时用的软件最新 开发环境为Visual Studio 2010,数据库为SQLServer2005,使用.net 4.0开发。 超市管理系统
- android事件分发
- Linux Shell编程之for循环结构
- 摘抄
- Centos6.0使用第三方YUM源(EPEL,RPMForge,RPMFusion)
- 快速排序
- 2015061101 - 寻找女儿国
- UIApplication
- c++ 实现五种基础的排序算法
- MYSQL优化浅谈,工具及优化点介绍,mysqldumpslow,pt-query-digest,explain等