divendres, 26 de setembre del 2014

Basic Git workflow





Open the Terminal, and create a directory named test wherever you  want, here we create the test directory on /tmp:


$cd /temp

/tmp $ mkdir test

/tmp $ cd test
/tmp/test$

Now we will create two files:

/tmp/test $ touch one.txt two.txt
/tmp/test $ ls
  one .txt two.txt

Right now we just have  a directory with two files.
Now we want to put our directory under version control. In order to do that we will write:

/tmp/test $ git init

Initialized empty Git repository in /private/tmp/test/.git/

What happened? Well, Git has just created a database of commits and a staging area, both void. Before the command git init we had just a directory, now we have three things: a directory, a staging area, and a database of commits.

Now let's put the two files on the staging area:

/tmp/test $ git add .

The staging area is just a virtual area when snapshots of changes are placed (using git add) before they are commited.
Now we can commit (take a snapshot or photo of the staging area):

/tmp/test $ git commit -m "First commit"

Ok, so now we have a first commit on our version control. We can see a list of commits with git log:

/tmp/test $ git log --oneline
4d6cf82 First commit

We have our commits saved on the local database.  But, what if we want to save on a public repository like GitHub?
That's easy. Go to github.com and create  a public repository: 




Once created, we go back to terminal and type:

/tmp/test $ git remote add origin https://giria@github.com/giria/test.git

That is, "add a remote repository called origin with that url"
Once added the remote repository, we can just push our local files to the servers of GitHub;

/tmp/test $ git push origin master
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 210 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://giria@github.com/giria/test.git
 * [new branch]      master -> master

And now our files, with all story of commits are stored on GitHub.

divendres, 19 de setembre del 2014

How to install XCode 6 GM (or any other XCode version) without deleting prior version

This is an English translation of  Diego Freniche original article




Theory

An OSX App is not more than a folder (a bundle) containing executable files and resources. We can see it on Finder right clicking an app file and selecting "Show package contents". It is even more evident from the Terminal:



$ cd /Applications/ 
$ ls -d Xcode*

drwxr-xr-x@ 3 dfreniche admin 102B 10 sep 09:47 Xcode.app/ 
drwxr-xr-x  3 root wheel 102B 16 abr 10:30 Xcode5.app/ 
drwxr-xr-x@ 3 dfreniche admin 102B 2 jul 02:52 Xcode6-Beta3.app/ 
drwxr-xr-x@ 3 dfreniche admin 102B 1 ago 23:17 Xcode6-Beta5.app/ 
drwxr-xr-x@ 3 dfreniche admin 102B 16 ago 00:35 Xcode6-Beta6.app/ 
drwxr-xr-x@ 3 dfreniche admin 102B 28 ago 09:01 Xcode6-Beta7.app/

we can see all versions of XCode installed. They are just UNIX directories.

On practice

During the beta stage, the XCode dmg file we download contains a directory named for example XCode6-beta6. This name is different than XCode so there is no conflict.

When the GoldMaster and ultimate version arrive, Apple releases a DMG  with an app named XCode. It is XCode 6 but it has same name that the previous XCode 5 that you have already installed in your machine. If you copy it will replace XCode 5.


Xcode5 before copying Xcode6 GM

But there is an easy solution: before copying the file to the Applications folder, rename Xcode (probably you  will need to introduce your administrator password) and set up your preferred name (it is up to you, I have one named Ye olde XCode 4.3).


Installing  Xcode 6 after renaming Xcode 5


Easy. Is it not?

dimarts, 16 de setembre del 2014

dimarts, 2 de setembre del 2014

Setting up two-step verification on Apple ID





In order to protect your iCloud media it is advisable to set up two-step verification on Apple ID. You are just some steps away of protecting your data:
 
  1. Go to My Apple ID.
  2. Select Manage your Apple ID and sign in.
  3. Select Password and Security.
  4. Under Two-Step Verification, select Get Started and follow the onscreen instructions