先看命令帮助的讲解 - 王胜 1 2 3 4 5 6 7 8 9 10 11 12 13 Victors-MPB:hello wangsheng$ git reset -h usage: git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>] or : git reset [-q] <tree-ish> [--] <paths>... or : git reset --patch [<tree-ish>] [--] [<paths>...] -q, --quiet be quiet, only report errors --mixed reset HEAD and index --soft reset only HEAD --hard reset HEAD, index and working tree --merge reset HEAD, index and working tree --keep reset HEAD but keep local changes -p, --patch select hunks interactively -N, --intent-to-add record only the fact that removed paths will be added later
各种模式对比
模式
HEAD是否重置
Index是否重置
working区是否重置
—mixed『缺省模式』
是
是
否
—soft
是
否
否
—hard
是
是
是
—merge
是
是
是
—keep
是
是
否
SourceTree 重置分析 重置 -> 丢弃文件变更
操作截图
实际执行的命令
1 2 3 git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree reset -q HEAD -- a .txt c.txt git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree checkout HEAD -- a .txt Completed successfully
1 2 3 4 5 6 7 8 9 10 11 Victors-MPB:hello wangsheng$ git st On branch feature2 All conflicts fixed but you are still merging. (use "git commit" to conclude merge )Untracked files: (use "git add <file>..." to include in what will be committed) c.txt nothing added to commit but untracked files present (use "git add" to track)
可以看出这样操作,git的上下文环境还在merge状态,这种情况一不小心就容易当做重置干净了,继续干自己的事情了,殊不知把别人的改动丢弃了。
重置 -> 重置所有
操作截图
实际执行的命令
1 2 3 4 git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree reset -q --hard HEAD -- git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree submodule update --init --recursive Completed successfully
1 2 3 Victors-MPB:hello wangsheng$ git st On branch feature2nothing to commit, working directory clean
快速集成TouchID - 杨志平
iPhone 5s,iOS 8,iOS7时未开放
依赖 LocalAuthentication.framework
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 LAContext *context = [[LAContext alloc] init]; [context canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics error: nil]; [context evaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason: @"reason" reply: ^(BOOL success, NSError *error) { if (success) { } else { } }];
错误类型
LAErrorAuthenticationFailed
LAErrorUserCancel
LAErrorUserFallback
LAErrorSystemCancel
LAErrorPasscodeNotSet
LAErrorTouchIDNotAvailable
LAErrorTouchIDNotEnrolled
LAErrorTouchIDLockout NS_ENUM_AVAILABLE(10_11, 9_0)
LAErrorAppCancel NS_ENUM_AVAILABLE(10_11, 9_0)
LAErrorInvalidContext NS_ENUM_AVAILABLE(10_11, 9_0)
dispatch_sync的坑 - 潘君 起因 dispatch_sync自己创建的队列 仍旧有可能在main thread上执行block
坑
问题 如何不让dispatch_sync卡主线程呢
答: 别在主线程调用此函数 哈哈哈
用途
AFNetworking在调用前判断是否是主线程
1 2 3 4 5 6 7 8 9 10 11 12 if (![[NSThread currentThread] isMainThread]) { dispatch_sync (dispatch_get_main_queue(), ^{ [self transitionToNextPhase]; }); return YES ; }
参考