Under the Radar

Under the Radar 22: Version Control


  welcome to under the radar a show about

  independent iOS app development I'm

  Marco Arment and I'm David Smith under

  the radar is never longer than 30

  minutes so let's get started so today we

  wanted to talk about version control and

  this is this is a great collaboration

  tool and therefore the two of us who

  work by ourselves are going to tell you

  drawing on our vast experience about

  using version control with all the

  clever things you hear about with like

  git and you can have merging and

  branching strategies and rebasing and

  all the things that thankfully I never

  have to deal with because I tend to just

  work by myself and I'm collaborating

  with myself and so thankfully things

  typically and like merge conflicts not a

  big problem for me it turns out Hudson's

  but still I think version control is a

  very important part of like the

  discipline of software engineering and

  so it seemed like it was something that

  was we worth discussing

  even if obviously you know jokingly some

  of some of them are collaborative parts

  of it aren't as relevant for us I mean

  for me like I have most of the same

  situation in that I'm mostly

  collaborating with nobody but there

  there have been times where I've seen a

  lot of the value of it Ferns I mean you

  know I used to work at normal jobs where

  I've had other people working with me so

  we would do things there but that was

  that was back in the subversion days and

  it was much simpler and it was still

  very small teams and these days you know

  I mostly you know don't do any kind of

  elaboration however I do have a couple

  of open-source projects that I run and

  and most of them get no activity

  whatsoever but a few of them do get

  third-party contributions and I have

  done you know get-get pull requests and

  merges and stuff like that and those

  things so I have minimal experience

  there and you and I actually just

  started accidentally collaborating on on

  something and I don't think that's even

  worth mentioning what it is it's it's a

  very very narrow need that both of us

  happen to have and almost nobody else

  does I committed to your codebase the

  other day and that was like the first

  time I've ever committed to someone

  else's iOS codebase and I thought and

  you said that was ever the first time

  that anyone's ever committed to yours


  it's been a very long time since like

  2011 2012 I think was the last time I

  had I had any kind of collaboration so

  yes it's it is very much a rare thing

  but it was kind of fun like I was like

  someone else it's like I have to do a

  fetch and have like a pool rather than

  just to push this is novel and exciting

  yeah I don't know how I would deal with

  that in my ABS I probably fix all the

  all the style differences which is like

  the huge faux pas to like restyle

  someone else's commit but like version

  control like there is a definitely

  collaboration is an important part of

  that and there are lots of different

  ways to deal with that like obviously

  like we're saying for us we don't do as

  much from a collaboration perspective

  but I've you know I've worked in

  companies where it's an important thing

  and there's lots of great mechanisms for

  this now like this is something that I

  think back to I think my first my first

  version control system was CVS I think

  yep and then I went to subversion and

  then to get and in every time like the

  tool itself gets better and less awkward

  and less cumbersome and I think about

  the things that are even things like

  github or bitbucket or there's lots of

  kind of these online backs or front ends

  for the repository which makes them any

  of these things so helpful and well I

  don't do a lot of it whenever I've had

  to do something like that where you have

  like you submit a pull request and you

  can have notes in code review and a lot

  of these things are nice and clear and

  obvious rather than just kind of sitting

  there at the command line trying to work

  out what's going on when someone else

  submits code and it crashes into yours

  and things are horrible and broken and

  so you know can you can do some pretty

  powerful things too like I remember back

  with Mayor Lee it is a version control

  where you had to like you would check

  out specific files that you were going

  to change and things like that that

  would be very cumbersome and you'd be

  like every now and then you'd go down

  the hall and you know like ask Jim down

  the hall hey are you done with that

  header because I need to add something

  to it for my part of the you know of

  this app and things like that which you

  know most modern version control systems

  can just deal with in terms of Bill you

  know you feel that if you add at the top

  and he had it's the bottom it just goes

  and that's fine and you know the

  concerns be problematic if he's changing

  something in one way and you're changing

  it or another but

  you know by and large collaboration is

  much easier from a version control

  perspective than it used to be because

  you can just you have these nice visual

  tools and you know mechanisms by which

  you can you know each share and share

  access into a repository yeah I mean

  it's it is so nice to have you know

  modern modern conveniences with these

  things and modern advancements I mean

  you know I - I never did the systems

  where checkouts are exclusive to one

  person but just basics of like

  versioning and merging from it all these

  systems are great and you know and

  especially like branching became a lot

  easier with git and then the DVCS model

  and these things I mean it just it just

  helps so much when you're working on a

  team and also when you're working by

  yourself and I think that's what we

  gonna talk about too is like even when

  you're working alone these systems

  provide invaluable help and and I think

  every developer this is actually I know

  that not every developer who works for


  does version control and I think not

  doing it as a huge mistake

  yes I don't even know how I mean that

  just seems like that's like the wild

  wild west where like are you like

  copying folders like any time you know

  like it's when you have like version 1

  version 2 version 3 like that's that's

  chilling yes use version control

  whatever it is it doesn't like its 20s

  it doesn't really matter which one you

  choose like if you're a get person and

  mercurial person if you want to use

  subversion if you want to do something

  else like that's fine but you have to

  use something because I think at you

  that's like the thing that you also can

  keep in mind with version control is

  like it's a powerful like development

  tool like in the way that you and I like

  we probably spend most of our

  development time in Xcode or in some

  ways and like textmate or something for

  doing like web programming but the tool

  it's the tool of version control is

  pretty powerful one in terms of it being

  a part of your development process and

  allowing you to do things that would

  otherwise be really awkward like I love

  and get having like branching of being

  able to be like I have this idea for a

  way to kind of restructure something or

  do a big refactor or take like take some

  code and you know take it in a different


  and I can just branch off from like my

  main thing try it for you know a few

  days and if I end up it turns out to be

  just this complete dead end I can sort

  of just like throw that away and go back

  to where I started from in a way that is

  nice and clean and reliable and isn't

  going to break something or if I need to

  want to just like cherry-pick part of

  that in I can do that in a controlled

  way and also just to look at what I've

  been doing like sometimes all you know

  it's being able to look at the like in

  some ways you'd think like the blame

  part of version control if you work by

  yourself and if you're not familiar like

  blame in most version control systems

  you can look at any line of code and see

  who created it and when that was created

  in the history of your project you know

  and so this is the classic like if

  someone breaks the build you can run

  blame on it and see who broke it but

  even for myself like when the names are

  always me it's often really helpful to

  be able to look back and be like why am

  I doing this this way and I can go back

  and see that comment interesting I added

  this as you know at you know two years

  ago when I was working on X feature and

  that's often really really really

  helpful to be able to look back and to

  understand my own code even better and

  even more so if it's you're

  collaborating with with someone else and

  even just to be able to like one thing I

  always do F as it have in my development

  cycle is I look I take the last commit

  that like the version that I just

  released and whenever I'm getting ready

  to submit to the app store like the very

  last step in before I hit like actual

  archive and submit to the app store is I

  always go and run a diff between the

  last submitted version and my current

  version of the code and I just go

  through like sort of line by line in all

  the changes and make sure that there's

  nothing in there that jumps out it to me

  is like whoa why is this still in here

  that are like that doesn't seem right

  and I've caught several bugs in my

  development in my process that way by

  having using version control as a tool

  to help me write better code yeah I mean

  that's the biggest value of it as

  independent is that it's it's it's

  giving you a tool that can show you what

  you've changed and when you changed it

  and possibly why you changed it but

  that's like just knowing what has

  changed whether it's what did I do

  today to this one file so I know whether

  to even commit this change or not or you

  know what's that you know what has

  changed in the entire app between this

  version which I know worked in this way

  and the current version which keeps

  having this weird bug that I can't

  figure out why it's happening you can go

  you can see all right well here's

  everything that's different between

  these two so the bug is because of some

  part of this you know and like it's it's

  so it's so useful to know that stuff

  everyone can get value out of that you

  know it also it helps it helps even if

  you have to work on multiple computers

  or if you're working on you know for

  like if you have a deployment on your

  server and one locally and your

  computer's you keep those synced up

  properly and in a sane way I mean it's

  it's just so great I I'm I'm still sure

  I'm shocked that anybody still doesn't

  use it but fortunately most people do

  use I think most people have come around

  to do it now so we're mostly mostly

  saying in that way in an industry that's

  insane and so many other ways we're

  mostly saying in that way yeah and it

  really helps in that regard that it's

  also becomes so much easier to do like I

  think of in Xcode like it has like

  full-on version control built into it

  like in terms of e not even like it's

  weird snapshotting thing that it always

  asks me when I'm refactoring a project

  and it asked me do I want to make a

  snapshot and I don't really know what

  that means I really don't think I do but

  it has it built in like it all of my

  projects whenever I'm changing something

  like it's really helpful in Xcode to

  just see what's changed and like once I

  change something it gets a little M icon

  next to it that says it's modified or

  for the additive fried file to it it's

  there and so there's no reason not to be

  aware of this type of thing

  because the tooling in is in place to

  make that just so easy and streamlined

  that they could be a fool not to yeah

  and what you know whether you do it on a

  hosted service like github or bitbucket

  or whether you do it just locally like

  you know you can almost all these

  systems you can have a local server if

  you want to and not have it significant

  like you know remote slash paid web

  service but I recommend if if you can

  swing it for you know regulatory reasons

  and for for money reasons I recommend

  just putting it on github or bitbucket

  like put it put it on one of the big

  hosts because it just it outsources a

  class of problems that you don't need to

  deal with anymore and also you get a

  whole lot of convenience for having that

  be on a hosted system you have the nice

  web gooeys you have the ability to

  access it from anywhere multiple

  computers you have kind of this built-in

  backup so it's yeah definitely hosts it

  if you can and please please use version

  control yeah and that's guessing too I

  think then another kind of interesting

  aspect to version control which is the

  like the backup portion of it yeah like

  both in terms of like what you're saying

  where like it's another physical backup

  like in the same way that you should

  have probably a clone of your main

  development harddrive running all the

  time and like backup in that sense of

  like being able to you know not have if

  my computer dies that's suddenly like

  I'm out of luck and that's it like the

  only copy of my code was sitting on that

  machine like that that that's terrifying

  like you have to have it backed up in a

  lot of ways because like the funny thing

  about being doing the kind of work we do

  like there's no sort of tangible the

  only tangible outcome of our work is

  like a collection of sort of like text

  files and images sitting on our hard

  drive and so like the amount of time and

  energy and money that goes into creating

  those we have to treat them like

  incredibly carefully like if we were

  it's like we were at coca-cola and we

  have to keep you know I imagine like the

  recipe for coca-cola is very well

  protected and backed up and guarded to

  make sure that they can keep making it

  because if somehow like it got lost and

  they didn't know the recipe anymore that

  would be hugely problematic and so as

  developers like our source code is that

  thing like even if we have a binary you

  know an old binary of our app like that

  doesn't do us any good we can't change

  that and so it's important to back it up

  both in terms of that kind of backup and

  then something else then I find it I've

  found it so helpful for many times to is

  it's having this like being able to go

  through like so thick you have this

  little time machine that you can go back

  in time and say what was my Apple like

  at a particular time and like you were

  saying earlier this is great for

  identifying bug like weird

  and bugs worth like it worked in version

  two but it doesn't work in version 3

  like why is that and you can actually go

  back and LOL it'll often end up doing is

  you know exports the project from my

  version control at a particular you know

  milestone and you know change the bundle

  identifier and i can run them both at

  the same time and i can kind of go back

  and forth and I can see why things are

  different and that kind of snapshotting

  is really helpful to be able to look

  back and then even one of the things

  that I've it's kind of more silly but I

  love sometimes being able to go back to

  like the verb like version 1 of a

  product after it becomes very mature

  both to kind of laugh at myself I just

  kind of look at it but also just kind of

  for nostalgia reasons of kind of looking

  at it and it's kind of nice to have a

  sense of like wow I've really come a

  long way you know this app used to be so

  simple and now it's it's it's so much

  more robust and I like that's kind of

  fun to have this backup of it that sort

  of never goes away in that way like I

  always like this is why I also version

  control all my screenshots that I submit

  to the app store yep you don't like like

  they're in there for that same reason

  that I sometimes is really fun or useful

  or like I'm doing a retrospective post

  you know like an app has the you know

  and when one of my apps hits a milestone

  like it's been you know it's oh it's

  five years old like if it's hitting a

  milestone it's kind of fun like do a

  blog post or something like that to kind

  of talk about it and show screenshots or

  the icon from a long time ago like

  version control is a great place to keep

  those things so it's all in the same

  place and it you know as time marches on

  you can keep a nice accurate record of

  what's changed alright our sponsor this

  week is Braintree Braintree is code for

  easy online payments they are a

  full-stack payment platform and you know

  why make payment integration more

  difficult than it has to be brand tree

  allows you to accept nearly any type of

  payment from any device with just one

  integration they support pave how

  bitcoin venmo Apple pay Android pay

  cards and they will support whatever is

  next all with that one integration it's

  flexible to your systems needs and

  supports most programming languages so

  whether using Java Ruby or Python you

  will always have a range of server-side

  and client-side SDKs available

  the Braintree client code supports

  Android iOS and

  script and all this takes just ten lines

  of code to implement Braintree makes

  payments and your job a whole lot easier

  learn more at Braintree payments comm

  slash radar once again that's Braintree

  payments comm slash radar thank you very

  much to Braintree for sponsoring our

  show and all of relay fm

  so I think what might make sense for the

  rest of the episode is to kind of talk

  about how this actually what we would

  like what we do in practice like what

  the actual tools that we use what that

  like goes around because I think there's

  there's certainly a degree to which

  version control can become a very like

  personal thing and some people like

  mercurial some people like it some

  people maybe even still love subversion

  or there's something new and fancier

  that I'm not aware of but like the you

  end up with these kind of preferences

  and at least I know for myself like I

  have kind of workflows and things that

  I've built up over time and that are

  part of this that maybe are helpful or

  if you're looking for a different way of

  doing it or different tools for it might

  be helpful to discuss so what is your

  typical like how do you actually

  interact with your version control

  system so on the server I just do it all

  by command line and I use git and I

  hooked on github which I would imagine

  github is probably one of the biggest

  reasons why people choose git and why

  it's so popular because github is is

  just so convenient in many ways and so

  good in many ways and it is it isn't

  perfect but it's it's very good I use

  github again private everything I pay

  for it it's fine it's it's been very

  secure for me and totally fine and

  honestly if somebody steals my source

  code somehow I don't really worry about

  that because source code is not very

  valuable like if you get somebody's

  source code to their entire app what do

  you do with that like you can upload it

  but that's illegal and they can easily

  get it taken down so like you know you

  can make your own app again also illegal

  from that you can get it taken down so

  like the actual value of stolen source

  code isn't particularly high for

  somebody's random iOS app so anyway back

  to how I use it I use the command line

  for almost everything I do in general in

  development so MySQL I use the command

  line interface to that if I'm doing

  development with other server-side

  demons like memcache or

  Redis I will use the command line to

  interface with those to set them up to

  to do administrative tasks if I need to

  ever get I usually don't do that anymore

  git is so complicated on the command

  line and so tedious on the command line

  that I usually just use git tower as my

  GUI which is a it's a Mac app it's some

  price it doesn't matter it's worth

  whatever price they charge it's worth it

  I think it's like 50 bucks whatever it

  is totally worth it yet because git is

  incredibly complicated and it doesn't

  need to be most in most use you can get

  by and it's it's totally fine and you'll

  be fine but sometimes you have to do

  something crazy with it or you have a

  weird error that you have to overcome

  and anything involving branching merging

  of branches certain advanced operations

  like committing only part of what you've

  changed or or discarding only part of

  what you've changed you can do all these

  things in the command line but it's so

  obtuse to figure out how to do that on

  get and many times things can be

  multiple commands and many times they're

  very error-prone if you do them manually

  and you and you could actually do some

  damage if you do it wrong so typically

  now I just use get tower on the Mac and

  I just don't do any kind of operations

  like that on the server I'm exactly the

  same I use guitar for pie like 99% of my

  get it just sort of it works it's very

  reliable it's straightforward and like

  the way that they present it to I've

  always found seem kind of works with my

  head like sometimes I've tried some

  other get clients and they can get very

  like they're showing me too much like

  they can get has all kinds of crazy

  information and metadata and things

  about especially when you have lots of

  branches like things that are going on

  and I they just hurt my head and like I

  likened the way that I used the way that

  I use get tower like it it's pretty

  straightforward like I open it up I open

  our repository it's like here's the

  things that you've changed and would you

  like to commit them and that's like most

  of my process is that and if I want to

  make a branch I just like pick the

  commit I want to branch from

  give it a name and now it's created and

  so it does a very good job of showing

  that to me in a way that's yeah it's

  like it's completely it's one of those

  essential tools like if I'm setting up a

  new computer there's a like in that

  first like five things that I will I

  will download onto it one of them is

  going to be good tower because I really

  can't work productively without it which

  is probably saying a lot yeah yeah I

  mean again like I I really do try to

  avoid GUI tools for for developer stuff

  where there is a perfectly suitable

  command line version but this is one of

  those things where it's so worth it it's

  it's it is so you know not only does it

  save me a lot of time and it makes

  certain operations you know less

  error-prone that are complex but also it

  just gives me a really good view of

  what's going on like you know at most

  what we mentioned before like a lot of

  what we were talking about is like how

  source control can can it can can show

  you and help you track what you're

  changing what you know what has changed

  over time how things used to be or how

  things are now and get tower is they

  just do a really nice job of showing the

  diffs showing the various commits and

  what was in each commit showing branches

  and letting you do that and it isn't I

  mean there are certainly there's

  something room for improvement in

  particular i I think the sub-module area

  is it could use some improvement but

  that's most of the most of the areas

  that I think tower could be improved

  including sub-modules I think are at

  least partially or or even mostly

  because the underlying get feature is

  itself complicated and finicky like

  sub-modules suck everything about get

  sub-modules is horrible and so I can

  understand why the implementation of the

  mint hour is also a little bit odd and a

  little bit finicky but ultimately I

  think if I'm going to be using git this

  is the way to do it

  yeah I agree and I think it's also

  probably worth contrasting to you I do

  use the version control integration in

  Xcode quite a bit but it's for like

  totally different things like like I use

  the so a it's just useful to be able to

  see what's changed and often what I'll

  end up doing is if in the US I called

  the Navigator view

  like the bottom left part of the Xcode

  browser you can say like show me only

  files that have changed that have like

  an active version control status and

  that's really helpful often I find when

  I'm like working on something and I can

  kind of just see the files that are sort

  of I've been working on and both it

  collapses a big project into a nice

  small list and it's also kind of just if

  I see something that doesn't look right

  like often I'll find like a nib file

  that has changed for some reason that I

  don't understand like I don't feel I

  opened it up once and touched it and

  then horrible things happen and being

  able to be aware of that earlier in the

  process it's helpful but most of what I

  do is they're very helpful like version

  control I don't even I'm sure they said

  have fancy names but like where you can

  compare inside of Xcode your current

  version to a past version so it's like

  if you're in the in the top right corner

  of Xcode there's like the three views

  there's like the regular view the

  companion view and then the version

  control view and in that I'm so often in

  there when I'm like looking at code and

  trying to see like what's changed how is

  this different how did I used to do this

  like if I have a problem that I used to

  solve once before I go in there and

  compare them and then like I was saying

  earlier right off I would you know

  surprisingly often for working just

  myself I'll use blame so let's switch it

  into blame mode and look through the

  source file and say like you know when

  did this change when do when did I start

  doing it this way what was that around

  and those kinds of tools and having them

  like built right in to Xcode is really

  useful like I go to tower regularly but

  it's when I'm done with something or

  when I'm getting ready to do a release

  or like in these kind of big strategic

  operations I love that Xcode has

  integration at the tactical level we're

  like I'm actually actively coding and in

  that process I don't have to contact

  switch to some other app to like look

  this up I can very easily just be like

  huh you know why am i doing it this way

  when did this change and that sort of

  thing and so I use those tools in Xcode

  a lot but I hardly ever commit or any of

  those types of operations you know from

  Xcode it has them like I'm sure they're

  there and you know it I'm glad they

  exist in some way so that like out of

  the box you can do

  version control but in Xcode I find it

  really helpful at that like basic like

  the actual line of code level and then I

  go to tower whenever I want to do like

  actual operations like things that I

  would go to a command line and type you

  know get clone get branch get merged get

  whatever I don't actually know what half

  of them are because I just used Tower

  instead so I didn't even know this

  version view was here I just open it up

  now and I'm like my mind is blown like

  oh my god this is so useful yes so

  someone has not been watching what's new

  and developer tools sessions index WDC

  for the last few years I think I think

  we just discovered that live on air does

  that surprise anybody I didn't read the

  manual this is great this is this is

  amazing all I would all I ever really

  use an Xcode was the little M indicators

  on the sidebar don't know what I've

  changed well there you go now you know

  that you can do some of these basic

  operations live at Xcode and like I said

  they're really helpful they're nice

  it turns out turns at all right anything

  else this week no I think that's it

  mostly I guess just to say make sure

  you're using version control please

  please please make sure you're using

  version control it's one of those things

  that if you're not for and like

  inversion everything like I version

  stuff like I mean there's I don't do a

  lot of like Photoshop work but when I do

  like I just mean I just put my PS DS

  into version control oh yeah and it

  doesn't do all the cool fancy dipping

  it's not fancy in that way but like I

  don't care I I can always go back in

  time I can always snapshot things like

  whatever you're doing try and version

  control it like I've version control my

  blog I version control anything I can

  because once you get into the discipline

  and the habit of doing it like it's just

  so much better and it's probably worth

  saying I'm terrible about commit

  messages because I'm just working by


  and it's hilarious like I in most of my

  commit messages are often just like

  stuff kind of works now yeah mmm this

  seems to be better fix fix fix okay

  that's enough like it cuz I'm still

  creating snapshots like I'm not

  necessarily communicating as well to my

  future self which is maybe you know like

  problematic too you know in some ways

  but just having it

  like just putting random gibberish in

  there and just like you'd be better off

  if you just say had get take a you know

  take a commit snapshot once an hour

  would be you know even if you didn't

  want to do anything like having just

  some kind of resource to be able to go

  back in time is so valuable and I think

  can make you such a better developer

  especially when you use the Xcode

  integration tools to understand how yes

  if you watch the videos you can really

  do some powerful things so I highly

  recommend them all right thanks a lot

  that's all the time we have this week so

  thanks for listening everybody thanks to

  our sponsor Braintree and we will see

  you next week bye

  I can't believe you didn't know those

  were there how did you not know there

  yeah that's there's a lot of Xcode I

  haven't explored yet like there's only

  there's only like in the default navbar

  like there's only like six buttons

  I just never click on those - yeah the

  one nice - semi circles the Venn diagram

  one the assistant editor I don't know

  what that does either that one is mostly

  just like useful for if you have an Abe

  in one view and like the related file

  and the other one okay like it's

  designed to have two things compared to

  like next to each other so that's useful

  if you like dragging outlets or things

  you know from who dragging outlets from

  India file into a source file I use the

  companion one but yeah I know there's

  this whole world the version of version

  control that's been waiting for you this

  is this whole time I'm so glad we

  captured that on