- copy the file
commit-msg
to.git/hooks/commit-msg
- make sure your delete the sample file
.git/hooks/commit-msg.sample
- Make commit msg executable.
chmod +x .git/hooks/commit-msg
- Edit
commit-msg
to better fit your development branch, commit regex and error message - Profit $$
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func combineDateWithTime(date: NSDate, time: NSDate) -> NSDate? { | |
let calendar = NSCalendar.currentCalendar() | |
let dateComponents = calendar.components([.Year, .Month, .Day], fromDate: date) | |
let timeComponents = calendar.components([.Hour, .Minute, .Second], fromDate: time) | |
let mergedComponments = NSDateComponents() | |
mergedComponments.year = dateComponents.year | |
mergedComponments.month = dateComponents.month | |
mergedComponments.day = dateComponents.day |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSDate *) roundDateTo5Minutes:(NSDate *) mydate { | |
NSDateComponents *time = [[NSCalendar currentCalendar] components:NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:mydate]; | |
NSInteger minutes = [time minute]; | |
int remain = minutes % 5; | |
if (remain < 3){ | |
mydate = [mydate dateByAddingTimeInterval:-60 * (remain)]; | |
}else{ | |
mydate = [mydate dateByAddingTimeInterval:60 * (5-remain)]; |