{"id":3707,"date":"2013-02-24T02:03:26","date_gmt":"2013-02-23T21:03:26","guid":{"rendered":"http:\/\/aasims.wordpress.com\/?p=3707"},"modified":"2025-04-09T12:17:20","modified_gmt":"2025-04-09T12:17:20","slug":"local-historyrevision-in-xcode","status":"publish","type":"post","link":"https:\/\/aasimnaseem.com\/blog\/local-historyrevision-in-xcode\/","title":{"rendered":"Local history\/revision of files in Xcode"},"content":{"rendered":"<p>Hello friends ..<a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2013\/02\/extra-xcode1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-3712\" src=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2013\/02\/extra-xcode1.png\" alt=\"extra-xcode\" width=\"193\" height=\"193\" \/><\/a><\/p>\n<p>hope things are going good on your desk ..<\/p>\n<p>Last night I was going through <a title=\"My twitter timeline\" href=\"http:\/\/www.twitter.com\/AasimNaseem\" target=\"_blank\" rel=\"noopener\">my tweets<\/a>, and there I found something really interesting; I crawled\u00a0it for few minutes and after reading some blog posts I came to know about a very useful but hidden feature that I always miss in <a href=\"developer.apple.com\/xcode\/\" target=\"_blank\" rel=\"noopener\">Xcode<\/a> .i.e. local history\/revision of your code files;\u00a0<em>(What!! what did you say!!! Say again &#8230; )<!--more--><\/em><\/p>\n<p>&nbsp;<\/p>\n<p>Surprised !! Ya its natural; I was too when I first tested this feature; <a href=\"https:\/\/twitter.com\/OliverDrobnik\">Oliver Drobnik<\/a>\u00a0first highlighted this feature in his\u00a0<a href=\"http:\/\/www.cocoanetics.com\/2013\/02\/radar-xcode-should-support-auto-save-and-versions\/\" target=\"_blank\" rel=\"noopener\">blog post\u00a0<\/a><a href=\"http:\/\/www.cocoanetics.com\/2013\/02\/radar-xcode-should-support-auto-save-and-versions\/\" target=\"_blank\" rel=\"noopener\">here<\/a>\u00a0after discussing with some Apple engineer. Infact\u00a0<a href=\"developer.apple.com\/xcode\/\" target=\"_blank\" rel=\"noopener\">Xcode<\/a> autosaves the versions of all of your code files you created inside your project; <i>(oh waoo, why I did never know this before? That sounds great) <\/i>You can view those revisions with respect to their time, compare them and can revert any file to your desire revision; You can even delete a revision to cleanup version history;<i> (man, enough; I can&#8217;t wait more, Tell me where is that option? File menu, edit, project? in which menu? )<\/i><\/p>\n<p>Well, unlike <a href=\"www.eclipse.org\/\" target=\"_blank\" rel=\"noopener\">eclipse<\/a> (a well know editor to develop <a href=\"www.java.com\/\" target=\"_blank\" rel=\"noopener\">java<\/a> based applications) <a href=\"developer.apple.com\/xcode\/\" target=\"_blank\" rel=\"noopener\">Xcode<\/a>\u00a0doesn&#8217;t provide any viewer to view those revisions; (<i>What!! are you in your senses!! No viewer? Then why the <a href=\"developer.apple.com\/xcode\/\" target=\"_blank\" rel=\"noopener\">Xcode<\/a>\u00a0saves those revisions if it doesn&#8217;t allow us to view them? No man you are kidding han!!<\/i>) No, I&#8217;m not kidding, its true; <a href=\"developer.apple.com\/xcode\/\" target=\"_blank\" rel=\"noopener\">Xcode<\/a>\u00a0doesn&#8217;t provide any viewer to view those revisions; The questions why <a href=\"developer.apple.com\/xcode\/\" target=\"_blank\" rel=\"noopener\">Xcode<\/a>\u00a0saves them, is still unanswered to me; But hold your breath, there is always a back door to step into home; (: We shall use <a href=\"http:\/\/support.apple.com\/kb\/ht2523\" target=\"_blank\" rel=\"noopener\">TextEdit<\/a>\u00a0application to view and restore those revisions; (<i><a href=\"http:\/\/support.apple.com\/kb\/ht2523\" target=\"_blank\" rel=\"noopener\">TextEdit<\/a> application!!! Man you know what, too many surprises in a row are injurious to health; Take care of me bro please)\u00a0<\/i><\/p>\n<p>To view the revision of any file, open it in <a href=\"http:\/\/support.apple.com\/kb\/ht2523\" target=\"_blank\" rel=\"noopener\">TextEdit<\/a> and chose File -&gt; Revert Document option; You will see the current version and all previous revisions side by side as shown in below screenshot;<\/p>\n<figure id=\"attachment_3708\" aria-describedby=\"caption-attachment-3708\" style=\"width: 595px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2013\/02\/screen-shot-2013-02-23-at-11-00-43-pm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3708\" src=\"https:\/\/AasimNaseem.com\/wp-content\/uploads\/2013\/02\/screen-shot-2013-02-23-at-11-00-43-pm.png\" alt=\"click to enlarge\" width=\"595\" height=\"371\" \/><\/a><figcaption id=\"caption-attachment-3708\" class=\"wp-caption-text\">click to enlarge<\/figcaption><\/figure>\n<p>I think the layout is pretty self descriptive; Select the revision from timeline at right and Restore it; To delete any revision just click the file name in title bar and select Delete Revision option; <i>(Yess, its showing me complete history, from the day when I created this file; Thumbs up bro, +1)<\/i><\/p>\n<p><strong>Usage<\/strong>: Sometimes when you are working on a module or fixing a bug, soon you feel that you have messed up all the code; Even the previously implemented thing are not working now; You try to undo your changes but you aren&#8217;t sure\u00a0 what was the stable state of your code; Don&#8217;t worry; Just take a sip of <a href=\"https:\/\/twitter.com\/AasimNaseem\/statuses\/162060278094241792\" target=\"_blank\" rel=\"noopener\">coke<\/a> and revert your code; Simple enough; You can do it by reverting your code to, let say, the code of 2 hours before, or the code state at day end of yesterday;<\/p>\n<p>Smiling han!!! You should; (:<br \/>\nHappy development;<\/p>\n<p><strong>Next Step:<\/strong> File a feature request at <a href=\"https:\/\/developer.apple.com\/support\/xcode\/\" target=\"_blank\" rel=\"noopener\">Apple development forum<\/a> to add viewer to view, compare and restore the revisions; <i>(Ya they should add such viewer inside the Xcode; I&#8217;m gone add my ticket there)<\/i><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/s09.flagcounter.com\/count\/nd4L\/bg_FFFFFF\/txt_000000\/border_FFFFFF\/columns_6\/maxflags_250\/viewers_0\/labels_0\/pageviews_0\/flags_0\/\" alt=\"Flag Counter\" border=\"0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends .. hope things are going good on your desk .. Last night I was going through my tweets, and there I found something really interesting; I crawled\u00a0it for few minutes and after reading some blog posts I came to know about a very useful but hidden feature that&#8230;<\/p>\n","protected":false},"author":1,"featured_media":4547,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[361,384,694,695,1117],"class_list":["post-3707","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios","tag-eclipse","tag-file-revision-in-xcode","tag-local-history-in-xcode","tag-local-history-objective-c","tag-xcode"],"_links":{"self":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/3707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/comments?post=3707"}],"version-history":[{"count":2,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/3707\/revisions"}],"predecessor-version":[{"id":4548,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/posts\/3707\/revisions\/4548"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/media\/4547"}],"wp:attachment":[{"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/media?parent=3707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/categories?post=3707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aasimnaseem.com\/blog\/wp-json\/wp\/v2\/tags?post=3707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}