您的位置:首页 > 编程语言

《learn-github-from-zero》 学习笔记

2017-02-14 14:38 239 查看

前言

《learn-github-from-zero》是一本初级入门github和git的电子书,作者是stormzhang,Android界一位无私的大神。该书从零基础开始讲解github和git,感兴趣的朋友可以阅读阅读一定会有所收获的,以下是阅读该书所做的笔记。

下载

github 影响力

全球顶级科技公司纷纷加入 GitHub ,并贡献他们自己的项目代码

Google: https://github.com/google

苹果: https://github.com/apple

Facebook: https://github.com/facebook

Twitter:https://github.com/twitter

微软:https://github.com/microsoft

Square:https://github.com/square

阿里:https://github.com/alibaba



全球顶级开源项目都优先选择在 GitHub 上开源

Linux:https://github.com/torvalds/linux

Rails:https://github.com/rails/rails

Nodejs:https://github.com/nodejs/node

Swift:https://github.com/apple/swift

CoffeeScript:https://github.com/jashkenas/coffeescript

Ruby:https://github.com/ruby/ruby



全球顶级编程大牛加入GitHub

Linux 发明者 Linus Torvalds:https://github.com/torvalds

Rails 创始人 DHH:https://github.com/dhh

被称为「Android之神」的 JakeWharton:https://github.com/JakeWharton , 你们用的

很多开源库如 ButterKnife、OkHttp、 Retrofit、 Picasso、ViewPagerIndicator 等都是出

自他之手!

git 安装

Mac:https://sourceforge.net/projects/git-osx-installer/

Windows:https://git-for-windows.github.io/

Linux:apt-get install git

git 命令

git branch

新建a分支

git branch a

切换到a分支

git checkout a

或者

新建并切换到a分支

git checkout -b a

删除分支

git branch -d

删除a分支

git branch -d a

强制删除

git branch -D

强制删除a分支

git branch -D a

合并分支

git merge

先切换到master分支,在执行下面的命令,就是将a分支的代码合并到master分支

git merge a

也是合并分支

git rebase

版本标签

git tag

给当前代码加上标签v1.0

git tag v1.0

查看当前有哪些标签

git tag

切换到v1.0标签状态

git checkout v1.0

github 代码提交

测试ssh是否添加成功

ssh -T git@github.com

git clone git@github.com:

git remote add orgin git@github.com:

git remote -v

git config –global user.name “xxx”

git config –global user.email “xx@xx.com”

设置log日志格式

git config –global alias.lg “log –graph –pretty=format:’%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset’ –abbrev-commit –date=relative”

设置git的编辑器为vim

git config –global core.editor “vim”

git开启着色

git config –global color.ui true

设置显示中文文件名

git config –global core.quotepath false

查看git的配置

git config -l

git diff

git diff <id1><id2> # 比较两次提交之间的差异

git diff .. # 在两个分支之间比较

git diff –staged # 比较暂存区和版本库差异

保存当前没有commit的代码

git stash

查看stash列表

git stash list

恢复保存的代码

git stash apply

删除stash的记录

git stash drop

恢复并删除stash的记录

git stash pop

清楚所有的stash记录

git stash clear

删除远程分支

git push origin :develop

将远程分支迁到本地

git checkout develop origin/develop

将远程分支迁到本地并切换到该分支

git checkout -b develop origin/develop

git flow

GitHub 开源地址:https://github.com/nvie/gitflow

http://stormzhang.com/git/2014/01/29/git-flow/

优秀的开源项目

free-programming-books

这个项目目前 star 数排名 GitHub 第三,总 star 数超过6w,这个项目整理了所有跟编程相关

的免费书籍,而且全球多国语言版的都有,中文版的在这里:free-programming-books-zh,

有了这个项目,理论上你可以获取任何编程相关的学习资料,强烈推荐给你们!

oh-my-zsh

俗话说,不会用 shell 的程序员不是真正的程序员,所以建议每个程序员都懂点 shell,有用

不说,装逼利器啊!而 oh-my-zsh 毫无疑问就是目前最流行,最酷炫的 shell,不多说了,懂

得自然懂,不懂的以后你们会懂的!

awesome

GitHub 上有各种 awesome 系列,简单来说就是这个系列搜罗整理了 GitHub 上各领域的资源

大汇总,比如有 awesome-android, awesome-ios, awesome-java, awesome-python 等等

等,就不截图了,你们自行去感受。

github-cheat-sheet

GitHub 的使用有各种技巧,只不过基本的就够我们用了,但是如果你对 GitHub 超级感兴

趣,想更多的了解 GitHub 的使用技巧,那么这个项目就刚好是你需要的,每个 GitHub 粉都

应该知道这个项目。

android-open-project

这个项目是我一个好朋友 Trinea 整理的一个开源项目,基本囊括了所有 GitHub 上的 Android

优秀开源项目,但是缺点就是太多了不适合快速搜索定位,但是身为 Android 开发无论如何

你们应该知道这个项目。

awesome-android-ui

这个项目跟上面的区别是,这个项目只整理了所有跟 Android UI 相关的优秀开源项目,基本

你在实际开发终于到的各种效果上面都几乎能找到类似的项目,简直是开发必备。

Android_Data

这个项目是我的邪教群的一位管理员整理的,几乎包括了国内各种学习 Android 的资料,简

直太全了,我为这个项目也稍微做了点力,强烈推荐你们收藏起来。

AndroidInterview-Q-A

这个就不多说了,之前给大家推荐过的,国内一线互联网公司内部面试题库。

LearningNotes

这是一份非常详细的面试资料,涉及 Android、Java、设计模式、算法等等等,你能想到的,

你不能想到的基本都包含了,可以说是适应于任何准备面试的 Android 开发者,看完这个之

后别说你还不知道怎么面试!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: