git乱码解决:在Ubuntu下,git status时,中文文件名乱码类似“274\232\350\256\256\346\200\273\347\273\223.png”,修改配置即可"git config --global core.quotepath false"

(参考:http://blog.zengrong.net/post/1249.html)

配置全局.gitigonre
添加文件~/.gitignore_global,然后在~/.gitconfig里加入:

  1. [core]
  2. excludesfile = ~/.gitignore_global
  1. .
  2. # 忽略所有后缀为.a的文件
  3. *.a
  4. # 不忽略lib.a(相对于上面的)
  5. !lib.a
  6. # 只忽略根下的TODO,不递归到子目录
  7. /TODO
  8. # 忽略所有build/下的文件
  9. build/
  10. # 忽略类似doc/notes.txt,但不包括doc/aa/bb.txt
  11. doc/*.txt
  12. # 忽略所有doc文件夹下的txt文件,递归到子目录
  13. doc/**/*.txt
  14.  
  15. . Short Status
  16. $ git status -s
  17. M README
  18. MM Rakefile
  19. A lib/git.rb
  20. M lib/simplegit.rb
  21. ?? LICENSE.txt
  22.  
  23. New files that arent tracked have a ?? next to them, new files that have
  24. been added to the staging area have an A, modified files have an M and so on.
  25.  
  26. .
  27. git diff 与已经commit的比较
  28. git diff --staged 已经add的比较与已经commit的比较
  29. git diff --cached staged同义
  30.  
  31. .
  32. git rm .txt 会真的删除文件2.txt(需要commit)
  33. git rm --cache .txt 只是移除git的管理状态,不会删除物理文件
  34. git rm log/\*.log 删除log文件夹中的.log文件,注意这里的\*中的\是对*进行转义
  35. git rm \*~
  36.  
  37. .
  38. git mv a.txt b.txt
  39. =
  40. mv a.txt b.txt
  41. git rm a.txt
  42. git add b.txt
  43. (这种3行命令的方式,git依然能够理解是在进行重命名操作)
  44.  
  45. .
  46. git log 查看log
  47. git log -p 查看每次提交的变化
  48. git log -p - 查看最近两次提交的变化
  49. git log --stat 查看提交的统计信息(如下:)
  50. README | ++++++
  51. Rakefile | +++++++++++++++++++++++
  52. lib/simplegit.rb | +++++++++++++++++++++++++
  53. files changed, insertions(+)
  54. git log --pretty=oneline
  55. git log --pretty=format:"%h - %an, %ar : %s"
  56. Option Description of Output
  57. %H Commit hash
  58. %h Abbreviated commit hash
  59. %T Tree hash
  60. %t Abbreviated tree hash
  61. %P Parent hashes
  62. %p Abbreviated parent hashes
  63. %an Author name
  64. %ae Author e-mail
  65. %ad Author date (format respects the date= option)
  66. %ar Author date, relative
  67. %cn Committer name
  68. %ce Committer email
  69. %cd Committer date
  70. %cr Committer date, relative
  71. %s Subject
  72. git log --pretty=format:"%h %s" --graph //a nice little ASCII graph
  73. git log --since=.weeks
  74.  
  75. . Undong Things
  76. git commit --amend //场景:刚已经进行了提交,但是可能有文件忘记了add
  77. 或者还有什么需要修改后在这次提交中提交的,可以使用--amend,这样可以将这些修改补充到刚才的提交中
  78. git add .txt
  79. git commit -m 'hahh, a commit'
  80. #oh no, a file named .txt is forgetten. but it should be committed in this commit
  81. git add .txt
  82. git commit --amend
  83. #hahah, 'amend' is useful.
  84.  
  85. git reset HEAD test.txt 撤销add
  86. git checkout -- test.txt 撤销修改(慎用!会使修改丢失)
  87.  
  88. .
  89. git clone https://github.com/schacon/ticgit
  90. git remote
  91. git remote -v
  92. git remote add pb https://github.com/paulboone/ticgit
  93. git fetch pb
  94. git remote show origin see much more information
  95. git remote rename pb paul 重命名
  96.  
  97. .
  98. Git uses two main types of tags: lightweight and annotated.
  99. A lightweight tag is very much like a branch that doesnt change its just a pointer to a specific commit.
  100. Annotated tags, however, are stored as full objects in the Git database】. Theyre checksummed; contain the tagger name, e-mail, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG). Its generally recommended that you create annotated tags so you can have all this information; but if you want a temporary tag or for some reason dont want to keep the other information, lightweight tags are available too.
  101.  
  102. git tag
  103. git tag -l 'v1.8.5*'
  104.  
  105. git tag -a v1. -m 'my version 1.4' 添加Annotated tag
  106. git show v1.
  107.  
  108. git tag v1.4.1-lw 添加Lightweight Tags
  109. git show v1.4.1-lw
  110.  
  111. git tag -a v1. 9ab3ef34 根据某次提交记录打tag
  112.  
  113. git push origin v1. 推送taggit默认是不会推送tag的)
  114. git push origin --tags 推送所有tag
  115.  
  116. git checkout -b version2 v2.0.0 根据标记创建分支
  117.  
  118. . git命令设置别名
  119. git config --global alias.unstage 'reset HEAD --'
  120. git unstage fileA
  121. 等效于:
  122. git reset HEAD fileA
  123.  
  124. git config --global alias.last 'log -1 HEAD'
  125. use: git last

参考:

1. git pro

git命令笔记2的更多相关文章

  1. git命令笔记

    git -bare init git remote add origin ssh://myserver.com/home/git/myapp.git git remote show origin [r ...

  2. git 命令笔记

    切换 git 远程仓库HEAD分支 $ git remote set-head origin some_branch

  3. Git初探--笔记整理和Git命令详解

    几个重要的概念 首先先明确几个概念: WorkPlace : 工作区 Index: 暂存区 Repository: 本地仓库/版本库 Remote: 远程仓库 当在Remote(如Github)上面c ...

  4. Git项目协同开发学习笔记1:项目库开发基础git命令

    这年头git基本都是项目开发的标配,之前刚好碰到了就花了两天时间系统学习了下.本文内容基本来自以下tutorial:Learn Git(建议直接去看原文,因为这个网站是有更新的).这个是我看过对git ...

  5. 项目管理---git----快速使用git笔记(六)------本地开发与远程仓库的交互----常用git命令

    无论是我们自己把本地的项目新建了一个远程仓库 还是 从远程仓库获取到了 本地,现在我们都在本地有了一份项目代码,服务器上对应有项目代码的信息. 现在我们就开始进行交互操作了. 也就是说明一些在 正常开 ...

  6. Git学习笔记整理【图像解析、基础命令、分支、远程仓库】

    Git别名设置:https://www.cnblogs.com/hero123/p/9105381.html Git远程项目公钥配置:https://www.cnblogs.com/hero123/p ...

  7. [git] 基础命令笔记

    --内容整理自廖雪峰的GIT教程-- git status 查看当前工作区状态,显示未跟踪的文件以及未上传的修改记录 git init 使当前文件夹变成Git可以管理的仓库 git add xxx 将 ...

  8. Git学习笔记01--常用Git命令、cmd命令及Git总结性知识

    资源:外国网友制作的 Git Cheat Sheet 第二次学习廖雪峰老师的Git教程,学习过程中把教程中涉及到的Git命令及总结性知识记录下来方便二次复习. 知识点 所有的版本控制系统,其实只能跟踪 ...

  9. 我所记录的git命令(非常实用)

    一.前言 记录一下工作中常用到的git命令,只是简单的笔记,欢迎大家交流... [ 顺便问下园友们,怎么感觉博客园发布的博客搜索有时都搜不到,后台编辑能填的都填写了,还是觉得搜索排名不高? 相同的标题 ...

随机推荐

  1. TinyFrame开篇:基于CodeFirst的ORM

    前言 做项目的这段时间,由于比较忙,一直没有机会闲下来思考.正好趁目前手头活儿轻松点,就花了一两天时间搭建了一个比较简单的框架,名称暂时就叫做:TinyFrame吧.顾名思义,就是微框架的意思.虽然这 ...

  2. 让 HTML5 来为你定位

    Geolocation HTML5 的 geolocation 是一个令人兴奋的 API,通过这套 API,Javascript 代码就能够访问到用户的当前位置.当然,访问之前必须得到用户的明确认可, ...

  3. DOM之parentNode与offsetParent

    DOM中有两个属性parentNode和offsetParent,想必区别大家都是知道的,可用法上还是有一些需要注意的地方,尤其是后者,想知道吗?继续往下看咯. parentNode指的是父节点,el ...

  4. dnsunlocker解决

    环境:windows 10 中文企业版,firefox47, chrome51 安装了某个国外程序后,浏览器各种不正常,打开网页慢,或是无法打开,更严重的是会弹广告,各种广告. 然后在控制面板中卸载了 ...

  5. C#开发命名规范

    学习C#之初,始终不知道怎么命名比较好,很多时候无从命名,终于有一天我整理了一份命名规范文档,自此我就是按照这个命名规范书写代码,整洁度无可言表,拙劣之处请大家斧正,愚某虚心接受,如有雷同,不胜荣幸 ...

  6. 十天冲刺---Day9

    站立式会议 站立式会议内容总结: 燃尽图 照片 队员们都回来了,写完之后继续对alpha版本进行迭代. 希望演示的时候能拿得出来.

  7. Day Four(Beta)

    站立式会议 站立式会议内容总结 331 今天:增加了若干话题:建立chat–user类,查阅bmob文档. 明天: 学习bmob的sql操作 442 今天:登录信息在主页上更新数据 遇到的问题:无 明 ...

  8. (02)javascript属性

    私有属性(私有变量和私有方法) 实例属性(实例变量和实例方法) 静态属性(静态变量和静态方法) <!DOCTYPE html> <html lang="en"&g ...

  9. Swift开发小技巧--自定义Log

    Swift中的自定义Log OC中有宏的定义,可以定义自己的Log,但是Swif中没有宏的定义,想要实现类似OC中的自定义Log,必须实现以下操作 1.在AppDelegate.swift文件中定义一 ...

  10. Jenkins_多项目构建(二):使用Maven聚集关系

        一.假设有四个Maven项目 1.soa-dub-parent:父项目 1 2 3 4 5 <modules>         <module>../soa-dub-f ...