I have a question, the answer isn't really hard technically, but I am more looking for the experience of most advanced programmers here.
So like many noobs, I am doing my version control in the crappiest way, which is to copy paste my project directory and rename it with the current date/time.
You will agree that it's a quite limited solution :P
I decided to learn version control system(s), but I am facing many choice, and I would like to know what are the best for your points of view ?
Using Xcode integrated version control (git or anything else), with organizer, cloning, commits from xcode etc. I mean totally or almost controlled by Xcode ?
Ignoring Xcode letting him think there no version control and doing it myself in command line ?
A merge of the two above ? How ?
And then :
Using git ? Github is very popular and powerful, but you must learn git, and learn it hard.
Mercurial ? It seems more friendly.
Something else ?
It would be priceless to have some feedbacks about more experienced people, so that me and many others I hope can choose their paths when facing the VCS wall :-)
Thanks a lot !!!
First: Use a VCS at all.
The rest:
Mercurial is nice, but Apple went with Git for Xcode. So if you want source control integration within the IDE, Git is the best option.
The things I miss most when working with Xcode & Mercurial are the "Modified" indicators in the source list and the integrated diff-viewer. (Which is pretty good in Xcode IMO)
The actions you perform in the Organizer are a bit limited at the moment, but you can always fall back to Terminal.app for that.
I can only recommend git. Merging is easy, I remember the days when a merge conflicts occured with SVN, it was pain, horrible pain to resolve those. You can easily start a local repository with git, especially if you are the only one developer.
Have a look at Which SCM system to use with Xcode 4 for a lone developer?.
I suggest some reading on git for the beginning:
Git in five minutes
Git Community Book
The Thing About Git
Take some time to invest in learning the basics of git, it's absolutely no rocket science to get you started on basic usage and you will benefit from it right away. Once you know the basics of git, you aren't locked into another tool wrapping git, you can use git if there are some problems with XCode. Also, git is available for several OS so the knowledge you gain about git will not go away if you move between different computers that have different OS.
Here are my best of bookmarks for git:
http://www.delicious.com/Ralphtheninja/bestof+git
I've had good success with SubVersion.
Related
I have a project and I want to work with another developer on the same project. I'm looking for a way to share the project between us, so that we can work on it parallel at the same time. I need it to work locally, without using an internet connection.
I'm a part of a 2-3 iOS developers team so I can give you a few tips from my experience on collaborating (we use git, I'm assuming you know a bit about. if not, read this), after you get the hang of it here are my thoughts -
Try to make as little change as you can to your project pbx file simultaneity, It'll result in a conflict almost every time
Don't be scared of branches, we're using them all the time, if you two are planning to work on different features of the same product try to do it in different branches
We had serious problems with storyboards and collaboration - like pbx their content change even on open and merging those changes can be very tiring
You already have Git available to you inside of XCode. You can share your code and work on it on the same time using "branching" mechanisms.
Bitbucket has excellent FREE private mode where you and 5 other people can share a Git repository. There are easy-to-use tutorials available on their site. I would highly suggest using that.
I would steer away from using SVN, there are better tools for what you are looking for.
Why don't you use SVN ?
You can configure SVN in Xcode for doing this. Also you can use Git.
Check:
Configuring Xcode to use subversion
Git Source Control With Xcode
Check this question How to set up an SCM in Xcode?.
There you will get links about how to setup SCM for xcode
I will start by saying this is probably a dumb question so apologies if I am staring at the answer but cannot see.
I have used VCS in the past primarily as a method of allowing me to revert my code if something goes wrong. I have always had a single lime of development. However I get into the usual trouble when releasing and starting the next version - dealing with bugs. So this time I decided to use branching (forking or whatever is the best name). I am a lone developer so I am the only one working with the repositiory. My scenerio is simple. I want to create a branch when I release so that I have a line for the released code and a line for the beta. I can then work happily on the beta. Now a bug comes in and I need to get back to the last commit for the release.
My question is what is the best way to get back that code in the IDE to work on it.
I have read that in Mercurial a simple way is to clone the repository including the working directory. This would give me two copies of the code base and I guess I can choose which one to load into the IDE. I would then use Push or pull to get the bug fixes from the release copy into the beta copy (I think).
I assume there must be another way however without cloning. How would I do that? I can guess at reverting to the last commit of the release code. Then I assume that loading the solution into the IDE would give me that. I am not sure where I would go from there when the code is done.
For the record I looked at a number of different VCS - I have used SVN in the past but wanted to go to a DVCS. I looked at Git, Bazaar, Mercurial and Veracity (and used Code-Coop in the past). You may think another tool would suit my needs better. Having tried the others however I found I could understand the way Mercurial works and the GUI tools such as TortoiseHg with the WorkBench and HgSccPackage (http://visualstudiogallery.msdn.microsoft.com/9bc074fa-9e1f-4ce2-a75d-b90e65f7475a) appeal
There are a lot of good documents and links here Introduction to Mercurial and I have read about different ways to branch that include using bookmarks and so on but they seem primarily targeted at multi member teams - which make sense of course
Many thanks in advance
You are mixing concepts a little, i guess you have SVN background ?
Just to answer you question, to 'get back the code in IDE' you will need to 'update' to a previous version. But this is considering you already have cloned the repository. Is your question about how to clone.. ? As you ask, there is no other way without cloning first. Cloning is the first step towards having a HG repository local. After clone, you can commit and push changes or pull and update.
To expand the answer even further and given that you are going to use Mercurial, here is what you should do:
read this : http://hginit.com/ - great HG (tutorial) by Joel Spolsky him self ! An introduction into HG and the concepts. You will need to understand this very good, since right now you are doing a lot of guessing, assuming and thinking :) HG/Git is different from SVN and in the begging the concepts might be hard to understand and to get used to.
for your project and regarding your question, have a branch called 'dev' or 'trunk' or 'version X' etc where you will commit all new changes.
have a branch called 'live' etc that will represent the current 'live' version. This way, whenever you need to revert back in time to the live version and to do a quick fix on it, you will 'update' to the tip of that 'live' branch, discarding all local changes (after you have committed to trunk! of course).
when putting a version to live, you will need to (assuming all changes are committed !) : update to the live branch then MERGE the version X into local (local being live ). This will include your versionX branch into live - it's what you need at this point. Then, either update back to version X branch or create a new branch - version X+1. This will take care of the versions and keeping the branches separate.
since you are using VS - install http://visualhg.codeplex.com/. HG source control integrated into VS.
I assume there must be another way however without cloning
Yes. You can use (named) branches inside single repo (I prefer HgSccPackage in VS), update to revisionbranch head, change, commit, merge
BTW, branching with bookmarks/clones/branches work the same (good) way for any size of team - it's a matter of taste
Every time I was thinking of switching all of our little team's projects to git / github, what pained me was that there didn't seem to be a tool to visualize all this social coding goodness.
When we all start wildly branching, forking and merging, I feel we're going to need a tool that would let us graphically see the full picture of our repository and its multitude of branches, in order to come up with a plan to merge it all back at some point into one and only truth (the proverbial origin/master).
I've tried googling for such a visualization tool on several occasions, but came up empty handed. Was hoping that GitHub for Windows would solve this once and for all, but all it shows is linear history for a particular checked out branch.
What I'm looking for is something akin to what TortoiseHg has - a graph showing all branches and commits. Are you aware of any such tools? (We're on Windows.)
SourceTree seems friendlier than TortoiseGit for the graphs and you can interact with the graph as well.
Stick with msysgit
gitk --all
is what you want. From there you can even checkout branches, reset them, view diffs, etc.
For something quicker, I would suggest
git log --all --decorate --oneline --graph
This gets piped through less by default which gives you good navigation including search.
Another option is just to install linux in a VM (virual box is free) and use tig. You can ssh to the VM so you don't have to deal with the VM itself while using linux.
GitExtensions is your best bet.
TortoiseGit is ok, though in it's attempt to "protect us from ourselves", they hide some of the native power of Git. Fail.
SeeGit is an interesting project from Phil Haack that helps visualize things.
The best tool is the command-line and a quick command like this is probably easiest and most powerful:
git log --oneline --graph --decorate --all
That pretty much would have to be TortoiseGit since you are already familiar with TortoiseHg. (Check All Branches)
Now days VScode has extension called git-graph, which worked best for my needs.
You could use Le Git Graph (read as legit graph), a browser extension that does exactly this, within browser.
Install the extension from here : https://chrome.google.com/webstore/detail/le-git-graph-commits-grap/joggkdfebigddmaagckekihhfncdobff
It will add a new "commits" section to every GitHub repo you open. Open the commits graph and there, all commits across branches will be listed along with the git graph.
Hope it helps!
An upvote would be highly appreciated!
Depending on your push \fetch \ pull habits then you can either use the gitk viewer to see what you know locally (including the remotes you have fetched), or you can use the Network capability on Github to see what it has.
Just select a multi-forked project (with not too many forks;-) and click on the network tab to see how all the other forks relate to it.
Some times you do need to switch fork to get the view point you want, but it's not too much hassle, and for a small team it looks ok.
I have made recent suggestions to Github about selectivity for forks (to down select when there are a lot of forks to display).
I started using Mercurial and chose MacHg as my GUI of choice, simply because it was the first thing I found when I googled Mercurial Mac GUI. However, I just recently discovered Murky, and TortoiseHg was recently updated for the Mac. Are there any significant reasons I should choose one over the other, or is the decision simply which application's interface I like the best?
I am the author of MacHg so of course am biased. Re Murky, it hasn't been kept up to date and it will fall over with large scale repositories when viewing history. It has to parse the whole history graph to lay it out (it uses the top level 'hg log'). Through a neat trick MacHg does this incrementally so if you have 200,000 commits MacHg doesn't need to read them all to figure out how to display them it can jump right to the place you are viewing. TortiseHg also suffers from having to read and parse the whole history although it can do this much faster than Murky (since TortiseHg uses faster lower level calls to get the data) (as reported to me by others.)
SourceTree seems like an ok solution. It is supported now commercially by Atlassian who do Bitbucket and they are a nice bunch of guys. However, as of my last test of SourceTree(1.4.3.1) it appears to be limited by the same problems. For instance one test case I use is the OpenOffice mercurial repository which is some 3Gigs with 260,000 revisions. Trying to view the graph for say revision 150,000 is really really slow in these other programs. I quit SourceTree after 5 minutes of waiting.
Also MacHg has some nicer history and rebasing tools if I do say so myself. SourceTree right now has better integration with some of the external services like Bitbucket and GitHub although it is not difficult at all to add repositories in MacHg (simple drag and drop or open, or paste in a string, etc...) Neither MacHg or SourceTree (AFAIK) have support for phases yet but I plan to add these very shortly as I am sure SourceTree will as well. TortiseHg has support for phases I think right now.
And well, I like "look and feel" of MacHg of course :)
You can't go too wrong with MacHg, or TortiseHg, or SourceTree unless you have large repositories in which case I would opt for MacHg for now.
Cheers,
Jason
This question is sort of subjective, but I've found SourceTree to be a good solution for visualizing your working copy. However, for the most part, I just use the terminal to commit/push/pull/update.
MacHg has at least straight forward instalation and Mercurial is integrated inside, what i missing is info, and there is also commandline interface, only documentation is not good enough.
I was in mac-mercurial / python / keyring configuring hell circle, i just new to setup repository for pulls without password asking (where pass is encrypted) from sh script for my build server. MacHg could be the way out, because everything is already integrated in instalation package, except mhg and chg aliases for normal (no MacHG) terminal.
I also missing some info about repository cloning progress, because i cloning 500 MB repository from bitbucket through https take me usually 2 hours. I need to debug if is problem on mercurial, ISP (it should be done in 2 minutes in regard of my connection speed) or bitbucket side.
Using Git on the mac feels like a huge pain, and the Git documentation is just huuuuuuuuge. Maybe someone has a top secret blog article or even screencast to share, that explains the basics fairly simple and quickly?
Creating a repository. Big pain.
Opening that repository with GitX: Pain.
Working in Xcode and then committing changes: No idea, probably big pain too.
Cloning the repository to a few other developers with their own macs so they can start collaborate on the project: Oh man, my head explodes... need a doctor!
Merging those cloned repositories back somehow, so everyone gets an updated repository with the changes of anyone else: Red alert!
Right now I feel I'll need a month to grok it. Would be SO glad if someone can point out really helpful resources that don't force me to read for some days... or is there a great and thin book that explains this madness?
Git is absolutely enormous, and you could certainly spend that month learning its processes, but you can stick to some basic concepts and end up with a really great workflow. I use the command line, as it allows you stick to these basics, and expand out if you need to. These basic commands are "pull", "push", "init", "commit -am "message"". Later, you can read about branches and rebasing at gitref.org.
As a mac Xcode + git user; I definitely recommend DTerm to make life easy. One key command brings up a floating terminal window, CDed to the directory of the file that's currently active. In XCode, this means that you'll be in a git-controlled directory immediately.
So, my workflow --
Use "git init" in the terminal to create a repository
Create github repository
follow github instructions to associate the two
When working in my project, press Shift-Command-Enter to bring up a floating terminal window
type "git commit -am "commit message" to commit all current changes
Same key combo plus "git pull" or "git push" for pulling in changes from code repository or pushing changes to code repository, respectively
I find that the command line allows a much easier working relationship with git than GitX, especially if you're using something like DTerm.
For a great reference, check out gitref.org. Good luck!
Launch a terminal window.
Creating a repository:
cd project-dir
git init
Opening the repository in GitX:
cd project-dir
gitx
Committing changes:
git status
git add . # or individual files
git commit
(it's a good idea to set up a .gitignore file from the beginning.)
Read the Pro Git book or look at some of the video tutorials at git-scm.com to get started quickly. The one by Linus is mostly a description of the implementation plus rant against other VCSs; the second video is really useful.
I used git under OSX for about 6 months (albeit not with Xcode). It's works a treat! But yes, it was a painful experience and a steep learning curve at times, especially when everybody else on the project are Windows developers (with more choice of git clients) and anti OSX (unwilling or unable to help). But it's well worth the effort in the long run. It's doable! Once you've got the basics, you'll find it's 10x better than say Subversion. Merges just work. Conflicts become more or less a thing of the past.
But my advice, forget GitX, it's crap. I started off with it, soon realised it doesn't do (or at least 18 months it didn't do) anything you can't easily do from the command line. It also does a whole lot less. So you end up in the terminal eventually anyway... and that's coming from someone who normally hates using the Terminal due to own incompetence! If you want a decent front end client, try Syntevo's SmartGit. Once I'd found that I quickly grew to love Git.
Also recommend reading the Pro Git ebook, mentioned by larsmans.
Understanding the simplicity of Git is hard. If you have some experiences with other (centralized) version control systems, try to forget them and understand Git's basic concepts (objects, commits, branches,..). There are lot of books out there. I would recommend the short (30 pages long) Git from bottom up, it is free and very useful. Another free learning materials are at gitcasts. Pragprog and peepcode have also great books and screencasts. They are not free, but useful.
I use git with XCode for several months, and they work together. Although XCode hasn't git listed as a supported version control system, you can use git from the command line. I tried to use GitX, but never found it more useful then git from command line. Try it out, maybe it fits your habbits more.
For XCode I found this gitignore and gitattributes file useful for my projects:
.gitignore:
# xcode noise
build/*
*.pbxuser
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
# osx noise
.DS_Store
profile
# other
.svn
*.swp
.gitattributes: *.pbxproj -crlf -diff -merge
I found the Git Book to be a really helpful resource. It explains the basics in simple terms and doesn't try to over-complicate things by going into the technical reasoning behind all the features. At least that's what I got from it.