I'm sure that Apple has an ingeniously "natural" way built into XCode that allows you to merge git conflicts and be done with them. I haven't figured it out. I'm not a git pro, though, so perhaps that has something to do with it? Anyway, here's how I figured out how to do it:
[This is from memory and subject to change]
1. resolve your conflict
2. Commit. By commit I don't mean select all the individual files you want to commit and commit them; I mean perform a commit from the repository viewer or file menu. If you try to do it the other way, you may need to do a "git reset --merge" or something like that.
Friday, May 6, 2011
Thursday, January 27, 2011
simple git tricks for the central repo brained
First of all, thank you Linus Torvalds for being brilliant. Also, curse you Linus Torvalds for being brilliant. But mostly thank you.
Git is awesome, powerful, and frankly simply better than svn. In order to keep it that way, I'm posting a couple simple tricks to help me remember how to get things done and keep myself from cursing such a brilliant and productive man. Yeah, I know I'm (slightly) miss-using git.
Creating a shared repository (one that more than one person can push to). I am very well aware that git is not designed to be a centralized repository system, and that it works better as a distributed system, but I'm just not willing to take the time to securely share my repository over the internet with my colleagues. Nor do I have the simple way to execute push and pull commands to random repositories in my head. Hence, I need a shared repository to simplify things for me. I don't think that's too much of a problem: I'm not developing a linux kernel, after all.
git --bare init --shared
easy, huh? Now what happens after cloning and attempting to push to the repository?
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
error: failed to push some refs to 'blahblahblahblah'
It's a simple configuration problem - user error. I need to specify where and what to push:
git push origin master
Git is awesome, powerful, and frankly simply better than svn. In order to keep it that way, I'm posting a couple simple tricks to help me remember how to get things done and keep myself from cursing such a brilliant and productive man. Yeah, I know I'm (slightly) miss-using git.
Creating a shared repository (one that more than one person can push to). I am very well aware that git is not designed to be a centralized repository system, and that it works better as a distributed system, but I'm just not willing to take the time to securely share my repository over the internet with my colleagues. Nor do I have the simple way to execute push and pull commands to random repositories in my head. Hence, I need a shared repository to simplify things for me. I don't think that's too much of a problem: I'm not developing a linux kernel, after all.
git --bare init --shared
easy, huh? Now what happens after cloning and attempting to push to the repository?
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
error: failed to push some refs to 'blahblahblahblah'
It's a simple configuration problem - user error. I need to specify where and what to push:
git push origin master
Monday, January 17, 2011
Git on Windows (7)
For anyone who hasn't heard of git, the cvs system designed and written by Linus Torvalds, git is awesome. I mean, line by line commits? And it's so easy!
My apollogies if this article isn't fancy and error free; I'm sick & tired (I love the kids, but hate what they carry).
First thing's second: we can actually skip installing git and go straight to the gui interface, because that will give us the option to install git. I'm not terribly keen on Tortoise - it's a pain to navigate the right-click menu - so I'm testing git extensions.
Installing Git Extensions:
Install MsysGit.
Install KDiff3.
Progress through a few default options; it's nice to see that it will integrate into Visual Studio 2010! I wonder what that will look like?
After installation is complete, open up Git Extensions and add a name, etc. These are, of course, to identify you as the author of any code you commit.
My apollogies if this article isn't fancy and error free; I'm sick & tired (I love the kids, but hate what they carry).
First thing's second: we can actually skip installing git and go straight to the gui interface, because that will give us the option to install git. I'm not terribly keen on Tortoise - it's a pain to navigate the right-click menu - so I'm testing git extensions.
Installing Git Extensions:
Install MsysGit.
Install KDiff3.
Progress through a few default options; it's nice to see that it will integrate into Visual Studio 2010! I wonder what that will look like?
After installation is complete, open up Git Extensions and add a name, etc. These are, of course, to identify you as the author of any code you commit.
Friday, August 6, 2010
Copy-Paste Code: Opening up Settings.plist
So you've bundled a Settings.plist, and now you want to know why you can't edit it? It's because it's not in a writable directory. Let's put that baby where she belongs:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
settingsPlistPath = [[documentsDirectory stringByAppendingPathComponent:@"Settings.plist"] copy];
NSFileManager *fileManager = [[NSFileManager alloc] init];
if (![fileManager fileExistsAtPath:settingsPlistPath]) {
NSString *bundledSettings = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"plist"];
[fileManager copyItemAtPath:bundledSettings toPath:settingsPlistPath error:NULL];
}
self.settingsDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPlistPath];
NSString *documentsDirectory = [paths objectAtIndex:0];
settingsPlistPath = [[documentsDirectory stringByAppendingPathComponent:@"Settings.plist"] copy];
NSFileManager *fileManager = [[NSFileManager alloc] init];
if (![fileManager fileExistsAtPath:settingsPlistPath]) {
NSString *bundledSettings = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"plist"];
[fileManager copyItemAtPath:bundledSettings toPath:settingsPlistPath error:NULL];
}
self.settingsDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPlistPath];
A Quick Way to Syntax Highlight Code
How to make code pretty before posting: it's easier than you think
Some people would prefer spending the time to set up a script that will highlight their code for them. There definitely advantages to this approach. Not wanting to spend the time and resources to set something like this up (as simple as it seemed to me to be), I opted for a google search: syntax highlight objective-c code online. There are plenty of options out there, but http://quickhighlighter.com/ is the one I liked the best. It has one drawback: you have to copy and paste two bits of HTML into your blog instead of one (it separates the css).
There are plenty of options to choose from, and you can even copy and paste the highlighted text into blogger, but (at least with Google Chrome) you loose the pretty gray box the code comes in.
Monday, August 2, 2010
Finding Memory Leaks - the easy way
From the iPhone Development Guide, "Debugging Applications"
Finding Memory Leaks
If you fix a leak and your program starts crashing, your code is probably trying to use an already-freed object or memory buffer. To learn more about memory leaks, see "Finding Memory Leaks".
You can use the NSZombieEnabled facility to find the code that accesses freed objects. When you turn on NSZombieEnabled, your application logs accesses to deallocated memory, as shown here:
2008-10-03 18:10:39.933 HelloWorld[1026:20b] *** -[GSFont ascender]: message sent to deallocated instance 0x126550
To activate the NSZombieEnabled facility in your application:
iPhone 3.1 SDK introduces the Leaks instrument, which you can use in the Instruments application to easily find memory leaks. For more information, see Instruments User Guide.
© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-05-28)
Finding Memory Leaks
If you fix a leak and your program starts crashing, your code is probably trying to use an already-freed object or memory buffer. To learn more about memory leaks, see "Finding Memory Leaks".
You can use the NSZombieEnabled facility to find the code that accesses freed objects. When you turn on NSZombieEnabled, your application logs accesses to deallocated memory, as shown here:
2008-10-03 18:10:39.933 HelloWorld[1026:20b] *** -[GSFont ascender]: message sent to deallocated instance 0x126550
To activate the NSZombieEnabled facility in your application:
- Choose Project > Edit Active Executable to open the executable Info window.
- Click Arguments.
- Click the add (+) button in the “Variables to be set in the environment” section.
- Enter NSZombieEnabled in the Name column and YES in the Value column.
- Make sure that the checkmark for the NSZombieEnabled entry is selected.
iPhone 3.1 SDK introduces the Leaks instrument, which you can use in the Instruments application to easily find memory leaks. For more information, see Instruments User Guide.
© 2010 Apple Inc. All Rights Reserved. (Last updated: 2010-05-28)
Saturday, July 31, 2010
Downgrading iPhone OS
Yes, sometimes you need to. Like if you have an iPhone 3G and you install OS 4 on it. And you don't like how unresponsive the OS got. Well, here's an excellent how-to. Don't forget the step with RecBoot - it's worth downgrading your phone just to see the message RecBoot gives you when you're done!
Subscribe to:
Posts (Atom)