《廖雪峰的Git教程》读书笔记

来源:互联网 发布:南通国税官网通知公告 编辑:程序博客网 时间:2024/06/04 23:33

1、图解


2、关联

将本地仓库和远程仓库关联:1、git clone git@<url>:<username>/xxx.git。或者2、git clonegit@<url>:<username>/xxx.git。

3、推送

将工作区提交到stage:git add<file>

将缓冲区提交到仓库:git commit –m <memo>

将本地仓库内容推送上远程仓库:git push –u origin <branchName>(首次需要带-u)

4、回退

回退修改(Workspace回退,针对add):gitcheckout --<file>

回退commit(stage回退,针对commit):git reset HEAD <file>

将远程仓库内容拉到本地仓库:步骤1(如果没关联):关联本地非master分支与远程非master分支 git branch --set-upstream branch-name origin/branch-name。步骤2:git pull

回退到以前的版本(版本库(非缓存区)回退):git reset –-hard HEAD^/HEAD^^/HEAD~10或者git reset –-hard<ID>

5、分支管理

本地创建分支:gitbranch <branchName>

本地切换分支:gitcheckout <branchName>

本地创建并且切换分支:git checkout –b <branchName>

本地创建和远程分支对应的分支:git checkout –b <branchName> orgin/<branchName>

删除分支:gitbranch –d <branchName>

合并某分支到当前分支:git merger <branchName>

合并某分支到当前分支(带合并commit的合并):gitmerge –-no-ff –m <memo> <branchName>

用带参数的git log查看分支的合并情况:git log –-grah –-pretty=oneline –-abbrev-commit

6、查看

查看日志:git log /git log –pretty-oneline

查看历史命令:git relog

查看工作区和版本库最新版本的差异:git diff HEAD

查看本地分支:gitbranch

查看远程分支:gitbranch –-remote

查看本地和远程分支:git branch –a

查看远程仓库的信息:git remote –v

 


http://my.oschina.net/xdev/blog/114383

http://os.51cto.com/art/201312/425331.htm

http://blog.csdn.net/weinianjie1/article/details/8947966

http://www.cnblogs.com/yaozhongxiao/p/3811130.html

http://www.cnblogs.com/mengdd/p/4153773.html
0 0