基本命令学的差不多了,已经可以满足工作需求,覆盖常见问题,都能通过以上的命令搞定,下面介绍一下特殊用法。
1 给命令起别名,用起来更方便。
示例:
| /// $ git config --global alias.st status $ git config --global alias.co checkout $ git config --global alias.ci commit $ git config --global alias.br branch $ git config --global alias.last 'log -1' $ git config --global alias.unstage 'reset HEAD' $ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" /// |
2 添加忽略文件。
开发过程中有时会产生中间文件,比如使用xcode总会生成一些user data 如断点信息等,这些文件传到仓库是没有用的,他随时在变化,所以push的时候可以忽略这些文件,忽略的规则是啥,其实有人已经总结好了,看一下,找到对应的变成语言添加即可。.gitignore文件。比如OC语言需要添加一下内容来忽略特殊文件。
示例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
///
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore.
However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Pods/
///
|